To explain the Viterbi algorithm, I will begin by reconsidering, using a diagram, the brute force approach to decoding I introduced before. The diagram, represented in Fig.

1.36 , is the concatenation of 6 (In general,

L =

l +

m = 4 + 2) trellises as the one drawn in Fig.

1.21 of this chapter.

Fig. 1.36 Concatenation of trellises

Using this diagram, coding can be thought of as following a path through the trellises : For the two branches emanating from each node, we move upwards when the digital source emits 0 and downwards when the bit is 1. Since we start at node A_{0} and must end at node A_{6} , the path corresponding to the input (1 1 0 1) is A_{0} C_{1} D_{2} B_{3} C_{4} B_{5} A_{6} . The coded sequence is (11 10 11 01 01 10), as indicated in Section 1.8 of this chapter.

In Fig.

1.37 , I have drawn the

received sequence used in Section

1.8 , together with the path corresponding to (0 0 0 0) and the 6 metrics calculated there. These metrics are called

branch metrics . The metric that measures the

closeness of this path to the received sequence is the

sum of the metrics of the 6 branches (namely: 24.48) and is called the

path metric . Similarly, to compute the metric of any other path we must calculate the metrics of its branches and add them together. Observe that, since all paths begin at A

_{0} and end at A

_{6} , some of the metrics are not needed. For instance: the metrics of the branches B

_{o} A

_{1} or D

_{5} B

_{6} are unnecessary. In Fig.

1.37 , all branches needed to calculate path metrics are labeled with their corresponding metric. The rest of the branches are left unlabeled.

We can now easily compute the 16 path metrics. For instance, the path metric corresponding to input (1 1 1 1) is

$$ 1.28+1.28+7.03+4.58+2.03+1.28=17.48 $$

In Table

1.1 , I have collected the metrics of the 16 paths corresponding to the 16 different inputs. I have ended the inputs by 00, since those two extra bits are required to reach A

_{6} .

Table 1.1 Inputs and path metrics in A_{6}

The minimum is 6.48. Therefore, the closest path to the received sequence is A_{0} C_{1} D_{2} B_{3} C_{4} B_{5} A_{6} and the estimated input sequence is (1101).

Notice that, in this example, the estimated input sequence coincides with the transmitted input sequence. Unfortunately, this does not always happen.

The computation and addition of branch metrics can be done as the symbols are received from the demodulator . In node A_{1} we store 0 as input information and 4.28 as path metric. Similarly, the information in node C_{1} is (1, 1.28). Continuing this way, the content stored in nodes A_{2} , B_{2} , C_{2} , and D_{2} is (00, 10.06), (10, 6.56), (01, 5.06), and (11, 2.56), respectively.

As the reception of symbols progresses, the amount of

data stored in each node grows larger and larger to the point that in node A

_{6} we have to store Table

1.1 . The tables shown in Fig.

1.38 for a few selected nodes, namely: C

_{1} , B

_{2} , B

_{3} , D

_{4} , B

_{5} , and A

_{6} , illustrate this growth.

Fig. 1.38 Tables in a few selected nodes

The growth is exponential and, therefore, this brute force method cannot be used in practice. The solution is based on a simple modification, known as the Viterbi algorithm that I will explain now.

In Fig.

1.39 , I have highlighted the paths from B

_{3} to A

_{6} . On the other hand, B

_{3} can be reached from A

_{0} following two paths: A

_{0} A

_{1} C

_{2} B

_{3} and A

_{0} C

_{1} D

_{2} B

_{3} . Altogether, we have four paths that arrive at A

_{6} passing through B

_{3} . Of course, we don’t know if any of these four paths will be the closest path to the received sequence.

Fig. 1.39 Only one of the paths arriving at B_{3} survives

However, we

for sure know that “the winner” cannot be either A

_{0} A

_{1} C

_{2} B

_{3} A

_{4} A

_{5} A

_{6} or A

_{0} A

_{1} C

_{2} B

_{3} C

_{4} B

_{5} A

_{6} . In fact (see node B

_{3} in Fig.

1.38 ), we have:

$$ {\displaystyle \begin{array}{l}\mathrm{Metric}\left({\mathrm{A}}_0{\mathrm{A}}_1{\mathrm{C}}_2{\mathrm{B}}_3{\mathrm{A}}_4{\mathrm{A}}_5{\mathrm{A}}_6\right)\\ {}=\mathrm{Metric}\left({\mathrm{A}}_0{\mathrm{A}}_1{\mathrm{C}}_2{\mathrm{B}}_3\right)+\mathrm{Metric}\left({\mathrm{B}}_3{\mathrm{A}}_4{\mathrm{A}}_5{\mathrm{A}}_6\right)\\ {}=8.59+\mathrm{Metric}\left({\mathrm{B}}_3{\mathrm{A}}_4{\mathrm{A}}_5{\mathrm{A}}_6\right)>2.59+\mathrm{Metric}\left({\mathrm{B}}_3{\mathrm{A}}_4{\mathrm{A}}_5{\mathrm{A}}_6\right)\\ {}=\mathrm{Metric}\left({\mathrm{A}}_0{\mathrm{C}}_1{\mathrm{D}}_2{\mathrm{B}}_3\right)+\mathrm{Metric}\left({\mathrm{B}}_3{\mathrm{A}}_4{\mathrm{A}}_5{\mathrm{A}}_6\right)\\ {}=\mathrm{Metric}\ \left({\mathrm{A}}_0{\mathrm{C}}_1{\mathrm{D}}_2{\mathrm{B}}_3{\mathrm{A}}_4{\mathrm{A}}_5{\mathrm{A}}_6\right)\end{array}} $$

The same applies to the path A_{0} A_{1} C_{2} B_{3} C_{4} B_{5} A_{6} .

Therefore, although we had two paths reaching B_{3} , only A_{0} C_{1} D_{2} B_{3} “survives,” and A_{0} A_{1} C_{2} B_{3} can be eliminated from further consideration. This implies that the first row in the table stored in B _{3} is not needed . In Fig. 1.39 this is represented graphically cutting out the branch C _{2} B _{3} .

We can use the same procedure at nodes A

_{3} and D

_{3} , which results in the elimination of branches A

_{2} A

_{3} and D

_{2} D

_{3} (see Fig.

1.40 ).

Fig. 1.40 Branch cutting at the nodes

A little problem occurs at node C _{3} because the two paths that arrive at this node, namely: (A_{0} A_{1} A_{2} C_{3} ) and (A_{0} C_{1} B_{2} C_{3} ), have the same metric (10.09). If the closest path does not go through C_{3} , this “local” tie has no consequences. If, however, C_{3} belongs to the path closest to the received sequence, the decision as to which branch to cut matters. In fact, if we decide that A_{0} A_{1} A_{2} C_{3} survives, the first three bits of the decoded sequence will be 0 0 1, whereas, if we eliminate A_{0} A_{1} A_{2} C_{3} , those three bits will be 1 0 1. The computed metric provides no clue as to which one of those two paths we should choose. Moreover, since the digital source is supposed to generate zeros and ones independently and with equal probability , we don’t have any reason to prefer 0 0 1 to 1 0 1 or vice versa. Therefore, when local ties occur, the surviving branch is chosen randomly . In our example, I decided to eliminate the branch A_{2} C_{3} .

The important feature of the Viterbi algorithm is that, due to the “pruning of branches,” there is only one path from A _{0} to any node . Therefore, the only row any node must store is the row of the surviving path avoiding this way the impossible task depicted in Fig. 1.38 .

The procedure can now be continued as more symbols are received from the demodulator. Here are the details for node D

_{4} . This node can be reached from C

_{3} and from D

_{3} . The metric of the best path from A

_{0} to C

_{3} is 10.09, and from A

_{0} to B

_{3} is 8.59 (see Fig.

1.40 ). Since

$$ 10.09+9.58>8.59+4.58 $$

we cut the branch C

_{3} D

_{4} , or equivalently, in the node D

_{4} we only store the third row of the table depicted in Fig.

1.38 .

A similar method can be applied to the remaining nodes.

Decoding can now be performed graphically by going back in the trellises from the terminating node , A_{6} . The path closest to the received sequence is highlighted in Fig. 1.40 .