2
$\begingroup$

How can I write an algorithm for finding the shortest path from one node to another in a graph using adjacency list and return a max value if no path exists? Do I use Dijkstra's algorithm and modify it to find the path?

$\endgroup$
  • 1
    $\begingroup$ isn't this exactly dijkstra's algorithm? $\endgroup$ – Jorge Fernández Hidalgo Oct 23 '16 at 18:50
1
$\begingroup$

Yes. Traverse the graph according to Dijkstra's algorithm and keep track of each current path while you go.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.