We can find the longest path in a graph by applying 2 bfs.
1st BFS is from our start node. The node which appear in last will be the
one farthest from the start node.Let this node be end1.
Now again apply bfs from end1 and the last node which appears will be the
another end.

Here I have made assumptions that graph is undirected and by this algorithm
i can tell the length of longest path, but to find actual path I am still
thinking. Correct me if  i am wrong.

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.

Reply via email to