Question: Step 1 : Inspect Vertex.java, Edge.java, and DirectedGraph.java Inspect the Vertex class declaration in the Vertex.java file. The Vertex class represents a graph vertex and

Step 1: Inspect Vertex.java, Edge.java, and DirectedGraph.java
Inspect the Vertex class declaration in the Vertex.java file. The Vertex class represents a graph vertex and has a string for the vertex label.
Inspect the Edge class declaration in the Edge.java file. The edge class represents a directed graph edge and has fields for a from-vertex and a to-vertex.
Inspect the DirectedGraph class declaration in the DirectedGraph.java file. DirectedGraph is an abstract base class for a directed, unweighted graph.
Step 2: Inspect AdjacencyListGraph.java and AdjacencyListVertex.java
The AdjacencyListGraph class inherits from DirectedGraph and is declared in AdjacencyListGraph.java. The vertices field is an ArrayList of AdjacencyListVertex references . The vector contains all the graph's vertices.
The AdjacencyListVertex class inherits from Vertex and is declared in the read-only AdjacencyListVertex.java file. The adjacent field is a vector of adjacent vertices.
Step 3: Inspect AdjacencyMatrixGraph.java
The AdjacencyMatrixGraph class inherits from DirectedGraph and is declared in AdjacencyMatrixGraph.java. The vertices field is a vector of Vertex references. The vector contains all the graph's vertices. The matrixRows field is a vector of matrix rows. Each row itself is a vector of Boolean values. If matrixRows[X][Y] is true, then an edge exists from vertices[X] to vertices[Y].
Indices in vertices correspond to indices in matrixRows. So if vertex "C" exists at index 2 in vertices, then row 2 and column 2 in the matrix correspond to vertex "C".
Step 4: Implement the AdjacencyListGraph class
Implement the required methods in AdjacencyListGraph. Each method has a comment indicating the required functionality. The vertices vector must be used to store the graph's vertices and must not be removed. New methods can be added, if needed, but existing method signatures must not change.
Step 5: Implement the AdjacencyMatrixGraph class
Implement the required methods in AdjacencyMatrixGraph. Each method has a comment indicating the required functionality. The vertices and matrixRows vectors must be used to store the graph's vertices and adjacency matrix, respectively. Both must not be removed. New methods can be added, if needed, but existing method signatures must not change.
Step 6: Test code, then submit
File Main.java contains test cases for each graph operation. The test operations are first run on an AdjacencyListGraph. Then the same test operations are run on an AdjacencyMatrixGraph. Results of each test are displayed.
After each method is implemented and all tests in Main.java pass, submit the code for grading. The unit tests run on submitted code are similar but use different graphs and perform direct verification of each graph's internal fields. is and perform direct verification of each graph's internal fields. are similar but use different graphs and perform direct verification of each \( g \)
. Files
AddEdgeCommand.java
AddVertexCommand.java
AdjacencyListVertex.java
AdjacencyMatrixGraph.java
DirectedGraph.java
DirectedGraphTestCommand.java
Edgeringa
GetVertexCommand.java
HasEdgeCommand.java
Main.java
VerifyEdgesFromCommand.java !
VerifyEdgesToCommand.java
Vertex.java
Run
Main.java
\(\times \) Adjacency
1 import java.io.*;
2
3
public class Edge \{
public Vertex fr
public Vertex to
public Edge(Verte
fromVertex = f
toVertex = to;
\}
@Override
public boolean eq
if (\(0==\) this)
return true;
\}
if (!)(o instanc return false b
DESKTOP
CONSOLE
Step 1 : Inspect Vertex.java, Edge.java, and

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!