Observe that each pair of adjacent levels in the model is equivalent to the original model from Figure 1.
the scores of the every label at each node in the graph can be calculated with a straight-forward bottom-up dynamic programming algorithm.