how can I find in linear time the longest path in a graph like this one:
3 -> 2
4 -> 3
2 -> 5
I know that the longest path here is 4 -> 3 -> 2 So it has 3 veticles but i dont know how to find it in O(N) time. Please help. thank you in advance.
how can I find in linear time the longest path in a graph like this one:
3 -> 2
4 -> 3
2 -> 5
I know that the longest path here is 4 -> 3 -> 2 So it has 3 veticles but i dont know how to find it in O(N) time. Please help. thank you in advance.