we can do this in a much better time than divya's algorithm since he does
the shortest path algorithm E+1 times

here's my approach:
find the shortest path using dijkstra since in dijkstra we have the shortest
path to each vertex
now look at the edges that end at the destination if the shortest path to
their other end + their weight is the shortest path to the destination then
they made the shortest path so if we remove them from graph and find the
shortest path again the result would be the second shortest path

so we can do it in 2 * running time of dijkstra

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algoge...@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