Longest Path Algorithm

Click anywhere in square to create vertex.
Select two vertices for directional edge.
Press the Longest Path button from 'A'.

Adjacency Graph structure

Dictionary of connected edges.
A: [B, C]
B: [C, D]
C: [D, E]
D: [F, G]
Example Graph

Longest Path Algorithm

Has to have a start and an end vertex.
Example Graph With End Point
Depth First Search algorithm.
Recursively assign the largest weight to each vertex.
Longest Path Example Graph
After Depth First Search.
Longest Path Example Graph
Count backwards from end vertex to start.
Longest Path Example Graph
Longest Path. Done
Longest Path Example Graph