Question

Shortest Path (DAG) Students, In this coding assignment, you will be asked to write Java code...

Shortest Path (DAG) Students, In this coding assignment, you will be asked to write Java code to read a text file (input.txt) of a graph represented as an adjacency list. Example: A, 7, B, 9, C B, 1, C C, 8, E, 2, F D, 1, E, 3, G E, 3, G F, 3, D, -3, H H, 6, G K, 3, H, -1, F The graph represented by the adjacency list above looks like this: The graph is a Directed Acyclic Graph (no cycles). You are required to write Java code to find one correct topological sorting for the graph; and after that, you will ask the user for a node (starting node), then you will print the shortest path from that node to all other (following nodes) Example, after reading the adjacency list above, if the user enters the value 'A' as the starting node, then your program should print the following: B: A - B (7) \\ Essentially, this means that the shortest path from A to B is A - B and its length is 7 C: A - B - C (8) \\ Essentially, this means that the shortest path from A to C is A - B - C and its length is 8 D ... \\ You will have to list all the shortest paths from A to all other nodes E ... F ... ... Your implementation of the topological sort should be efficient

graphAssignment2.png

0 0
Add a comment Improve this question Transcribed image text
Request Professional Answer

Request Answer!

We need at least 10 more requests to produce the answer.

0 / 10 have requested this problem solution

The more requests, the faster the answer.

Request! (Login Required)


All students who have requested the answer will be notified once they are available.
Know the answer?
Add Answer to:
Shortest Path (DAG) Students, In this coding assignment, you will be asked to write Java code...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Similar Homework Help Questions
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT