Question: Please answer the question. Thanks. 3. Based on the following graph, write a program to display the data structure representing the graph that consists of


Please answer the question. Thanks.
3. Based on the following graph, write a program to display the data structure representing the graph that consists of number of vertices (points) and the edges (lines). Use edge array to represent the edges Alor Star (0) Kota Bharu (1) George Tonn (2) Kuantan (3) Ipoh (4) Kuala Lumpur (5) Seremban (6) Johor Bahru (7) The output shall display the following output The number of vertices in graph: 8 The vertex with index 5 is Kuala Lumpur The vertex with index 3 is Kuantan The index for Alor Star is 0 The index for Kuantan is 3 The edges for graph: Alor Star (0): (0, 1) (0, 2) (0, 5) Kota Bahru (1): (1, 0) (1, 2) (1, 3) (1, 5) George Town (2): (2, 0) (2, 1) (2, 4) (2,7) Kuantan (3): (3, 1) (3, 4) (3, 5) (3, 7) Ipoh (4): (4, 2) (4, 3) (4, 5) Kuala Lumpur (5): (5, 0) (5, 1) (5, 3) (5, 4) (5, 6) Seremban (6): (6,5) (6, 7) Johor Bahru (7): (7, 2) (7, 3) (7, 6)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
