How to find the shortest path of nodes in java....?
We have 8 nodes in the 2 paths to reach the destination we have to find which one path is the shortest.. ???
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend5days leftRegister
Mukil VendhanRank #2,971 · 486 reputationPosted Aug 14, 2017, 6:24 AM EDT
Zakir AhamedRank #1,545 · 1K reputationPosted May 20, 2017, 4:37 AM EDT
Manikandan MurugesanRank #300 · 8.4K reputationPosted Aug 14, 2017, 7:54 AM EDT
There's no reason not to use Dijkstra's algorithm here.The code above produces:
Distance to Z: 49.0 Path: [A, M, R, P, Z]