Question: In this part, you will implement the data model to represent a graph as well as edges in the graph. Implement the following two classes

 In this part, you will implement the data model to represent

a graph as well as edges in the graph. Implement the following

In this part, you will implement the data model to represent a graph as well as edges in the graph. Implement the following two classes Graph.java: This class uses an adjacency matrix as instance variable that can represent any weighted directed graph. It must have a default constructor and a constructor that expects an adjacency matrix as parameter. By default, the adjacency matrix represents the following weight undirected graph 2 4 The Graph class must have all methods in the following class diagram. A description for each method is given below Edge.java: This class represents a single edge in the graph consisting of the starting node, end node, and weight of the edge. The Edge must have all methods in the following class diagram. ava lang. Comparable Graph Edge - intI0 matrix +Graph +Graph(int[Il] adjacencyMatrix) +boolean hasEdge(Integer from, Integer to) +int weight(Integer from, Integer to) +List Edge> getOutgoingEdges(Integer from) +List Integer> getNodes) +String toString0 - Integer from; - Integer to - int weight +Edge(Integer from, Integer to, int weight) +Integer getFrom) +Integer getToO int getWeight(0) +int hashCode) +boolean equals(Object o) +String toString0

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 Databases Questions!