CSE 2320 Section 060/061 Spring 1999
Due: April 29, 1999, 1pm (April 30, 1999, 5:00pm for -10%)
For this program you will implement a Web Visualizer that builds a
graph based on the hypertext links within a set of HTML files and outputs
the graph in a format that can be visualized using the daVinci Graph
Visualization tool. As usual, you cannot use global variables.
- Version 2.1 of daVinci is stored in the daVinci_2.1 directory
in the class directory on omega. To run daVinci from omega,
you will need to be at a computer console running X-windows. First, make
sure you have allowed X-windows access to omega by entering the
following iin a console window.
Then, login to omega and enter the following, where <machine>
should be replaced by the name of your local machine.
setenv DISPLAY <machine>:0.0
setenv DAVINCIHOME /public/cse/2320-061/daVinci_V2.1
setenv LD_BIND_NOW yes
You will have to accept a license agreement and register by email if you
like, and then the main daVinci window should appear. daVinci will also
start Netscape with the online documentation. From the daVinci window, you
can load in sample graph files form the File menu, including the
sample PGM4 output in pgm4/pgm4out. There are versions of daVinci
for other platforms (Sun, SGI, Linux, but not MS-Windows) available at http://www.tzi.de/davinci.
- In your program define a graph data structure using the adjacency
list representation. You will need procedures for allocating a graph,
deallocating a graph, and adding vertices and edges to the graph. Vertices
should have an integer identifier and a string label whose maximum length
is 80 characters.
- Implement a recursive procedure that scans a file for hypertext
links, adds vertices and edges to the graph for new links, and recursively
scans the referenced files (if they exist). Hypertext links will be of the
form <A HREF="link">, where link is a
case-sensitive string. You may assume that hypertext links are not broken
across lines. For each new link encountered in the file, you should add a
vertex to the graph. If the link identifies a file in the same directory
as the initial input file, then the label should be link; otherwise,
the label should be in parentheses, i.e., (link). Also
for each new link, an edge should be added from the vertex of the current
file to the new vertex. If the file contains more than one link to the
same file, only one edge should be added to the graph.
- Implement a procedure that outputs the graph in daVinci format. You
can deduce the format from the pgm4/pgm4out file and from the syntax
description available through the Help menu (Overview
Term Representation for
syntax of the term representation). Or, open
the following file in your browser on omega.
- Your main program will allocate a new graph, process the file whose
name is given as the first argument to your executable, output the final
graph in daVinci format, and then deallocate the graph. You may assume the
graph will contain no more than 100 vertices. You may also assume your
program will be executed in the directory containing the HTML files, so you
do not have to worry about handling path information. You can test the
correctness of your output by saving it to a file and loading it into
- Be sure to properly document your source code, as described in
Program 1. After ensuring that your program compiles and executes
correctly on the omega machine, run the program /public/cse/2320-061/handin4 to electronically hand in your source file.
All source code must be in one file (i.e., no separate .h and .c files).