Shortest-path Dijktra’s algorithm implementation

This implementation inherits the source code from Geeksforgeeks (matrix implemented). What i did is to implement Dijktra’s algorithm for shortest path problem using linkedlist graph. Souce code can be found here – here

/src/stp_linkedlist : implements graph using linked list

/src/stp_matrix: using adjacent matrix to imploy graph

To run the program, first initialize a graph by editting file /src/graph.txt. This first line of the file is the number presenting the number of nodes in graph. The remaining lines are just a graph representation of the undirected, weighted graph. i.e:

9
0 4 0 0 0 0 0 8 0
4 0 8 0 0 0 0 11 0
0 8 0 7 0 4 0 0 2
0 0 7 0 9 14 0 0 0
0 0 0 9 0 10 0 0 0
0 0 4 0 10 0 2 0 0
0 0 0 14 0 2 0 1 6
8 11 0 0 0 0 1 0 7
0 0 2 0 0 0 6 7 0

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s