Question: Java code and no JOption Pane please. Use the author's version of SimpleGraph (attached) as your starting point and add the methods requested. For part

Java code and no JOption Pane please.

Use the author's version of SimpleGraph (attached) as your starting point and add the methods requested. For part A of #36, the pseudocode represents your up front thinking on this problem. Be sure to test your programs

36. We wish to expand the class SimpleGraph, shown in Figure 9.14, to include methods to delete a vertex, delete an edge, fetch a vertex, fetch an edge, update an edge, update a vertex.

a. Give the pseudocode of the methods' algorithms.

b. Extend the code of the class SimpleGraph, to include the new methods and write a simple application to demonstrate they function properly.

37. Modify the class SimpleGraph so that it can store a weighted graph and expand its methods to include those mentioned in Exercise 36.

Figure 9.14

Java code and no JOption Pane please. Use the author's version of

1 class SimpleGraph /I a directed graph, (digraph) 2. Listing vertex[ the reference to the vertex array int edge II reference to the adjacency matrix array int max, numberOfVertices; public SimpleGraph (int n) vertexnew Listing[n] allocation of the vertex array 6 8 10 edgenew intnn adjacency matrix initialized to zeros max n numberOfVertices0; public boolean insertVertex (int vertexNumber, Listing newListing) 11.if (vertexNumbermax) I the graph is full 12 return false vertex[vertexNumber]newListing.deepCopy return true; I end insertVertex method numberofVertices++ 14 16 17. 18 public boolean insertEdge (int fromVertex, int toVertex) { if (vertex(fromvertex] == null II vertex(tovertex] == null) return false; /I nonexistent vertex edge[fromVertex[toVertex]1; return true; 20 21.I end insertEdge method public void showVertex (int vertexNumber) System.out.printin(vertex[vertexNumber]); I end showVertex method 23 24 25 26 27. 28 29 30 31. i end of class SimpleGraph public void showEdges (int vertexNumber) emanating from vertexNumber { for(int column 0; column

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!