Student Name: __________________
Class and Section __________________
Total Points (20 pts) __________________
Due: Wednesday Oct 13, 2010 before the class
Project: Display a Graph
CSCI 1302 Advanced Programming Principles
Armstrong Atlantic State University
Problem Description:
A graph consists of vertices and edges that connect vertices. Write a
program that reads a graph from a file and displays it on a panel. The
first line in the file contains a number that indicates the number of
vertices (n). The vertices are labeled as 0, 1, …, n-1. Each
subsequent line, with the format u x y v1, v2, …, describes that the
vertex u is located at position (x, y) with edges (u, v1), (u, v2),
etc. Figure (a) gives an example of the file for a graph. Your program
prompts the user to enter the name of the file, reads data from the
file, and displays the graph on a panel, as shown in Figure (b).
(a) (b)
The program reads the information about the graph and
displays it visually.
Analysis:
A graph is a mathematical structure with vertices and
Design:
The program should first read the information about
the graph from a file. The program prompts the user
to enter the file name and read vertices location