First of all let’s clear thing up:

Finding the longest path of a graph algorithm is NOT the inverse of Dijkstra’s algorithm of finding the shortest path. In fact finding the longest path of a graph in NP-Hard problem.

In our case, the graph is a tree-shaped graph, more like a triangle.

1 2 3 4 5 6 7 |
8 / \ 1 4 / \ / \ 4 2 0 / \ / \ / \ 9 1 9 4 |

## Recent Comments