This post originated from an RSS feed registered with Java Buzz
by Arpit Mandliya.
Original Post: Dijkstra’s algorithm in java
Feed Title: Java tutorial for beginners
Feed URL: http://feeds.feedburner.com/arpitmandliyasblog
Feed Description: A blog about java programming language and its frameworks
In this post, we will see Dijkstra algorithm for find shortest path from source to all other vertices. Problem You will be given graph with weight for each edge,source vertex and you need to find minimum distance from source vertex to rest of the vertices. Algorithm There will be two core classes, we are going to use for Dijkstra algorithm. Vertex: This class contains name, visited flag, predecessor(To track the short path, so that we can backtrack) and distance from source node and also the list of outgoing edge from this vertex. Edge: This class contains Source vertex, target vertex,