|
CSE Home |
About Us |
Search |
Contact Info |
Here is the random graph generator for use in Assignment #5:
The program generates (somewhat) random graphs in such a way as to
produce (hopefully) interesting examples for the project. You can
see samples
here.
It is a command-line program, and takes four parameters, only the
first of which is required: the number of vertices.
The generator outputs lines containing integers. The first line contains the number of vertices in the graph; each successive line will consist of a pair of numbers, representing an edge between those two vertices. To save random graph data, redirect the output to a file, like this:
rndgraph 16 > graph16a
rndgraph 16 > graph16b
rndgraph 35 > graph35
The file graph16a will then contain random graph data
for a 16 node graph, graph16b will contain a different
16 node graph, and graph35 will hold a 35 node graph.
Alternatively, you may be able to "pipe" its output directly into
your program:
rndgraph 16 | mybiconnectedcomponentsmasterpiece
rndgraph 16 | mybiconnectedcomponentsmasterpiece
will run your program on two different 16 node graphs.
The optional parameters provide additional control over the generated graphs, which may be useful for your debugging and for your timing study. In more detail, the 4 parameters are:
rndgraph 16 0 42 | mybiconnectedcomponentsmasterpiece
rndgraph 16 0 42 | mybiconnectedcomponentsmasterpiece
rndgraph 16 0 0 | mybiconnectedcomponentsmasterpiece
rndgraph 16 0 0 | mybiconnectedcomponentsmasterpiece
will run your program on the same 16 node graph twice, then on
two different (and basically unrepeatable) ones.Thus, the following command:
rndgraph 99 50 42 1 > savegraph-99-50-42-1
will generate (and save to a file) a graph with 99 vertices and
average degree of 50, with shuffled node numbers, all based on the
specific pseudo-random sequence with seed 42. The sample graph
shown near the top of this page was produced by
rndgraph 8 2 3 0
8 nodes, degree about 2, no label shuffle, seed 3. Try it; you
should get the same graph with those parameters, namely:
8
0 1
0 2
1 2
2 7
3 4
3 7
4 5
4 6
5 6
5 7
6 7
|
Computer Science & Engineering University of Washington Box 352350 Seattle, WA 98195-2350 (206) 543-1695 voice, (206) 543-2969 FAX [comments to cse417-webmaster@cs.washington.edu] | |