• Home
  • Blog
  • Write a Java program ShortestPathFinderApp.java

Write a Java program ShortestPathFinderApp.java

0 comments

Write a Java program ShortestPathFinderApp.java that reads the input graph as a text file, and finds the Minimum Spanning Tree rooted at the node specified as a run time argument. Your program should be invoked as

java ShortestPathFinderApp input-file root-node destination-node

where input-file is the name of a text-file that contains the weighted adjacency list, root-node is the starting point to the shortest path algorithm and the destination-node is the node whose shortest path you will be printing at the end of the program.

Your program should compute the shortest path, and print the routing table entry of the root node for the destination-node represented as a three column row as follows:

Node Cost Next-Hop

In addition, your program should print the path used by the root node to reach the destination node. For example, if the shortest path from root node A to C is through B, your program should print the path is AàBàC.

About the Author

Follow me


{"email":"Email address invalid","url":"Website address invalid","required":"Required field missing"}