Q:

(Display a graph) Write a program that reads a graph from a file and displays it. The first line in the file contains a number that indicates the number of vertices (n)

0

(Display a graph) Write a program that reads a graph from a file and displays it. The first line in the file contains a number that indicates the number of vertices (n). The vertices are labeled 0, 1, . . . , n-1. Each subsequent line, with the format u x y v1 v2 ..., describes the position of u at (x, y) and edges (u, v1), (u, v2), and so on. Figure 28.24a gives an example of the file for their corresponding graph. Your program prompts the user to enter the name of the file, reads data from the file, and displays the graph on a pane using GraphView, as shown in Figure 28.24b.

FIGURE 28.24 The program reads the information about the graph and displays it visually

All Answers

total answers (0)

Similar questions


need a help?


find thousands of online teachers now