0 Mohave 12 La Paz 11 Yavapai 14 Maricopa Coconino 13 Yuma 2 Navajo 10 Gila 8 Pinal (13 7 Pima 12 9 Graham Apache 6 Santa Cruz 5 Cochise Greenlee. 16 vertices[0] Mohave vertices [1] Coconino vertices[2] Navajo vertices[3] Apache vertices[4] Greenlee vertices[5] Cochise vertices[6] Santa Cruz vertices[7] Pima vertices[8] Pinal vertices[9] Graham vertices[10] Gila vertices[11] Yavapai La Paz vertices[12] vertices[13] Yuma vertices[14] Maricopa

icon
Related questions
Question
100%
The purpose of this project is to assess your ability to: · Implement a graph abstract data type.   A graph is a set of vertices and a set of edges. Represent the vertices in your graph with an array of strings:
 Represent the edges in your graph as a two-dimensional array of integers. Use the distances shown in the graph pictured here.

Add the following functions to your graph class: · A getDistance function that takes two vertices and returns the length of the edge between them. If the vertices are not connected, the function should return the max value for an integer. ·  A getNeighbors function that takes a single vertex and returns a list of all the vertices connected to that vertex.  ·  A print method that outputs an adjacency matrix for your graph. Write a test program for your Graph class in JAVA.
0
Mohave
12
La Paz
11
Yavapai
14
Maricopa
Coconino
13
Yuma
2
Navajo
10
Gila
8
Pinal
(13
7
Pima
12
9
Graham
Apache
6
Santa
Cruz
5
Cochise
Greenlee
16
vertices[0] Mohave
vertices [1] Coconino
vertices [2] Navajo
vertices[3] Apache
vertices[4] Greenlee
Cochise
vertices[5]
vertices[6] Santa Cruz
Pima
vertices[7]
vertices[8] Pinal
vertices[9] Graham
vertices[10] Gila
vertices[11] Yavapai
La Paz
vertices[12]
vertices[13] Yuma
vertices[14] Maricopa
Transcribed Image Text:0 Mohave 12 La Paz 11 Yavapai 14 Maricopa Coconino 13 Yuma 2 Navajo 10 Gila 8 Pinal (13 7 Pima 12 9 Graham Apache 6 Santa Cruz 5 Cochise Greenlee 16 vertices[0] Mohave vertices [1] Coconino vertices [2] Navajo vertices[3] Apache vertices[4] Greenlee Cochise vertices[5] vertices[6] Santa Cruz Pima vertices[7] vertices[8] Pinal vertices[9] Graham vertices[10] Gila vertices[11] Yavapai La Paz vertices[12] vertices[13] Yuma vertices[14] Maricopa
Expert Solution
steps

Step by step

Solved in 6 steps with 2 images

Blurred answer