Question
The purpose of this assignment is to assess your ability to: Implement a graph abstract data type. A graph is a set of vertices and
The purpose of this assignment 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 in Java for your Graph class. Be sure your test program demonstrates all functionality. When you are finished, submit the following: Your code in a zip file
vertices[O] 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 vertices[12] La Paz vertices[13] Yuma vertices[14] Maricopa The purpose of this assignment is to assess your ability to: Implement a graph abstract data type. Coconin Apache Mohave Yavapai Santa CRUZ A graph is a set of vertices and a set of edges. Represent the vertices in your graph with an vertices[O] 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 vertices[12] La Paz vertices[13] Yuma vertices[14] Maricopa The purpose of this assignment is to assess your ability to: Implement a graph abstract data type. Coconin Apache Mohave Yavapai Santa CRUZ A graph is a set of vertices and a set of edges. Represent the vertices in your graph with anStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started