Question
PLEASE DO IT IN JAVA AND MAKE SURE IT WORKS public interface WeightedGraphInterface { boolean isEmpty(); // Returns true if this graph is empty; otherwise,
PLEASE DO IT IN JAVA AND MAKE SURE IT WORKS
public interface WeightedGraphInterface
boolean isFull(); // Returns true if this graph is full; otherwise, returns false. void addVertex(T vertex); // Preconditions: This graph is not full. // Vertex is not already in this graph. // Vertex is not null. // // Adds vertex to this graph.
boolean hasVertex(T vertex); // Returns true if this graph contains vertex; otherwise, returns false.
void addEdge(T fromVertex, T toVertex, int weight); // Adds an edge with the specified weight from fromVertex to toVertex.
int weightIs(T fromVertex, T toVertex); // If edge from fromVertex to toVertex exists, returns the weight of edge; // otherwise, returns a special null-edge value.
UnboundedQueueInterface
void clearMarks(); // Sets marks for all vertices to false.
void markVertex(T vertex); // Sets mark for vertex to true.
boolean isMarked(T vertex); // Returns true if vertex is marked; otherwise, returns false. T getUnmarked(); // Returns an unmarked vertex if any exist; otherwise, returns null. }
R30. Design and code a reference-based weighted graph class with the vertices stored in a linked list as in Figure 9.11(b). Your class should implement our Weighted GraphInterface. R30. Design and code a reference-based weighted graph class with the vertices stored in a linked list as in Figure 9.11(b). Your class should implement our Weighted GraphInterfaceStep 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