Question: Write a program that lets the users create a weighted graph dynamically. The user can create a vertex by entering its name and location, as

Write a program that lets the users create a weighted graph dynamically. The user can create a vertex by entering its name and location, as shown in Figure 29.27. The user can also create an edge to connect two vertices. To simplify the program, assume that vertex names are the same as vertex indices. You have to add the vertex indices 0, 1, . . ., and n, in this order. The user can specify two vertices and let the program display their shortest path in red.55.0 55.0 $7.0 69.0 87.0 Add a new edge Find a shortest

55.0 55.0 $7.0 69.0 87.0 Add a new edge Find a shortest path Add a new vertex Vertex u (index): 0 Starting vertex: Vertex name: x-coordinate: 230 Ending vertex: Vertex v (index): 4 Shortest Path Weight (int): y-coordinate: 130 69 Add Edge Add Vertex Start Over (dear Graphs)

Step by Step Solution

3.60 Rating (168 Votes )

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

Program Plan Create a class DisplayGraph that extends Application class Create three text field one for insertion of vertex name second for x coordinate and third for y coordinate Create one Add Verte... View full answer

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 Java Programming Questions!