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

PLEASE DO IT IN JAVA AND MAKE SURE IT WORKS

public interface WeightedGraphInterface { boolean isEmpty(); // Returns true if this graph is empty; otherwise, returns false.

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 getToVertices(T vertex); // Returns a queue of the vertices that are adjacent from vertex.

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 GraphInterface

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!