Walk predecessors backward and reverse the path. This is a small deterministic example, not solver engineering.

Example

Walk predecessors backward and reverse the path. Beginning at the destination, follow each predecessor link back toward the start, collecting the vertices you pass through. Because those links point from each vertex to the one before it, the collected sequence comes out in reverse, so flipping it yields the actual route in order from start to destination.

highlighted = computed this step

Step 1 — Reverse walk

Compute the highlighted combinatorics value.

reverse path(E, D, C, B, A)\begin{array}{c|c}\text{reverse path}&\hlmath{\text{(E, D, C, B, A)}}\end{array}

Step 2 — Forward path

Compute the highlighted combinatorics value.

path(A, B, C, D, E)\begin{array}{c|c}\text{path}&\hlmath{\text{(A, B, C, D, E)}}\end{array}
combinatorics-search Every row is intentionally ordered and pinned to the lesson specification.