Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

NetBeans Java Code: Well documented please. Create the part of the code that ask

ID: 3696289 • Letter: N

Question

NetBeans Java Code: Well documented please. Create the part of the code that asks the user for two cities and return the shortest links between them.

Your task for this assignment is to create one or more software methods to determine the shortest path between anytwo specified nodes in a directedweighted graph that represents links between U.S.cities. The Netbeans project CityProject has software that creates a graph of selected U.S. represented by an array of vertices and an array of edges. Each city is a vertex in the graph. Each link between cities is an edge in the graph, as shown below in the output from the project as it currently exists

Explanation / Answer

The first class is a Vertex class, which represents a city and the road segments that run outward from that city.

The second class is a simple Edge class that represents edges. In this application Edges are directed. Since Edges are stored in Vertices, we will always know what city the Edge comes from. The only thing the Edge itself needs to represent is the Vertex the Edge goes to and the length of the road segment that this Edge represents.

Finally, the graph is represented as a collection of Vertices. Since we will very often need to look up Vertices by their city names, the Vertices are actually stored in a Map that uses the city names as keys and the Vertices themselves as values.

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote