Question: Help Question1 Write a program to print the direct distance between two nodes of the graph given in Fig. Ql. Use adjacency matrix to represent
Question1 Write a program to print the direct distance between two nodes of the graph given in Fig. Ql. Use adjacency matrix to represent the graph Kuala Lumpur I Singapore 2 Bangkok 3 Jakarta 4 Yangon 120 min 140 min 60 min 180 min 50 min 90 min 70 min Fig. Q1 The program should 1. print the available nodes, 2. prompt user to key in a source node and a destination node, and 3. print the distance from the source node to the destination node; print "No direct route" if no direct route exists. L/4 O T ype here to search Sample output: 0 Kuala Lumpur 1 Singapore 2 Bangkok 3 Jakarta 4 Yangon From: To:2 Ruala Lumpur to Bangkok 60 min Note: You must strictly follow the given output format. Marking scheme: (total 10 to be scaled to 5 Define node labels Define adjacency matrix Print the available nodes Prompt user for inpus Print route Print distance Print "No direct route A decent program with no compiler error
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
