The belief that complex systems require armies of designers and programmers is wrong. A system that is not understood in its entirety, or at least to a significant degree of detail by a single individual, should probably not be built. Niklaus Wirth

Dijkstas algorithm

Language Java | Level Intermediate | Category Algorithms | August 5, 2015 8:04 am


Algorithm Problem Description

Dijkstras algorithm is an algorithm for finding the shortest paths between nodes in a graph. Dijkstra's Algorithm solves the single-source shortest path problem in weighted graphs. It is similar to Prims algorithm. Dijkstra algorithm can be used for graphs with all positive weight edges only. Dijkstra is not lacks distribute property.

Write a program to implement Dijkstra's algorithm

Output

          	        
          	        

Distance to Delhi: 0.0
Path: [Delhi]
Distance to Mumbai: 5.0
Path: [Delhi, Mumbai]
Distance to chennai: 8.0
Path: [Delhi, Mumbai, chennai]
Distance to Bangalore: 8.0
Path: [Delhi, Bangalore]
Distance to Pune: 10.0
Path: [Delhi, Bangalore, Pune]

          	        
          	        				    


Comments



Please login to add comments.