The HMM dynamic programming trick
    This is an efficient way of
computing a sum that has
exponentially many terms.

   At each time we combine
everything we need to know
about the paths up to that time
into a compact representation:
     The joint probability of producing
the sequence up to time    and
using node i at time
     This quantity can be computed
recursively:
i               i               i
j                    j                     j
k                    k                    k