Question: JAVA(PROGRAMMING LANGUAGE) - DATA STRUCTURES-GRAPH OUTPUT: Based on the following map, write a program to display a graph that consists of the vertices (points) and
JAVA(PROGRAMMING LANGUAGE) - DATA STRUCTURES-GRAPH

OUTPUT:

Based on the following map, write a program to display a graph that consists of the vertices (points) and the edges (lines), G=(V, E). The edges are connected in the following order: 0-Gua Kelam Caves, 1-Chuping Sugar Plantation, 2-Snake Farm, 3-Tasik Melati, 4- Perlis State Mosque, 5-Perlis Royal Palace, 6-Perlis State Museum, 7- Bukit Kubu Recreational Forest and 8-Kangar Capital. You are required to implement array in order to represent the vertices and edges, and print the edges accordingly. Gua Kelam Caves N Chuping Sugar Plantation Snake Farm Tasik Melati Lake Kangar Capital Perlis State Mosque Perlis State Museum Perlis Royal Palace Bukit Kubu Recreational Forest PERLIS GPP { TestGraph.java UnweightedGraph.java String[] vertices = {"Gua Kelam "Perlis Royal Palace","Perlis int [] [] edges = { 10,1),(0,2). (1,0), (1,3), {2,0), (2,3), (2,8), (3,1),(3,2), (3,4),(3,8), (4,3), (4,5), (5,4), (5,6), Interactions Console Compiler Output Welcome to DrJava. Working directory is C:\Users\Owner Des > run TestGraph The number of vertices in graphl : 9 The edges ARRAY for graphl : Gua Kelam Caves (0): (0, 1) (0, 2) Chuping Sugar Plantation (1): (1, 0) (1, 3) Snake Farm (2): (2, 0) (2, 3) (2, 8) Tasik Melati (3): (3, 1) (3, 2) (3, 4) (3, 8) Perlis State Mosque (4): (4, 3) (4, 5) Perlis Royal Palace (5): (5, 4) (5, 6) Perlis State Museum (6): (6,5) (6, 7) Bukit Kubu Recreational Forest (7): (7, 6) (7, 8) Kangar Capital (8): 18, 2) (8, 3) (6, 7) Running main Method of Current Document Type here to search
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
