• Home
  • History
  • Annotate
Name Date Size #Lines LOC

..03-May-2022-

AMIGA/H28-Mar-2007-402320

ANSI/H28-Dec-2003-223186

MSVC/H28-Mar-2007-3,3982,653

PROTOTYPES/H28-Dec-2003-2,6312,346

ERRATAH A D26-Mar-200713.4 KiB383229

MakefileH A D03-May-20224.6 KiB178114

READMEH A D25-Mar-200712.9 KiB275252

README.PROTOTYPESH A D03-May-20223.8 KiB10884

SMakefileH A D03-May-202211.4 KiB364315

abstract.plaintexH A D10-Sep-199611.2 KiB248211

anna.datH A D15-Jun-19939.6 KiB384382

assign_lisa.chH A D03-May-2022304 109

assign_lisa.wH A D25-Apr-200229.6 KiB707634

blank.wH A D16-Aug-1993132 1510

boilerplate.wH A D15-Jun-19931.8 KiB3935

book_components.chH A D03-May-2022658 2018

book_components.wH A D09-Feb-199422.6 KiB502433

cities.texmapH A D16-Feb-19956 KiB161154

david.datH A D15-Jun-19936.6 KiB158156

econ.datH A D15-Jun-199321.2 KiB892810

econ_order.chH A D03-May-2022304 109

econ_order.wH A D27-Aug-199312.6 KiB319284

football.chH A D03-May-2022757 2825

football.wH A D27-Aug-199325.6 KiB626547

games.datH A D15-Jun-199313.7 KiB793792

gb_basic.chH A D03-May-20228.6 KiB240223

gb_basic.wH A D10-Aug-200997.8 KiB2,4472,173

gb_books.chH A D03-May-20222.2 KiB5955

gb_books.wH A D25-Mar-200723.2 KiB549487

gb_dijk.chH A D03-May-20223.7 KiB153138

gb_dijk.wH A D29-Mar-200516.4 KiB454379

gb_econ.chH A D03-May-2022634 2018

gb_econ.wH A D14-Sep-200027.5 KiB637560

gb_flip.chH A D03-May-2022578 4437

gb_flip.wH A D24-Apr-200211.1 KiB267223

gb_games.chH A D03-May-20221.4 KiB3532

gb_games.wH A D07-Nov-199719.2 KiB476423

gb_gates.chH A D03-May-20225 KiB183166

gb_gates.wH A D22-Oct-200874.6 KiB1,9351,733

gb_graph.chH A D03-May-20225.8 KiB202182

gb_graph.wH A D08-Jun-199637.3 KiB942813

gb_io.chH A D03-May-20223.9 KiB194168

gb_io.wH A D18-Dec-199621.1 KiB586500

gb_lisa.chH A D03-May-20223.3 KiB9690

gb_lisa.wH A D01-Nov-199627.1 KiB653570

gb_miles.chH A D03-May-20221.4 KiB4238

gb_miles.wH A D23-Jun-200316.1 KiB404354

gb_plane.chH A D03-May-20223.8 KiB152137

gb_plane.wH A D01-Jan-200139 KiB995885

gb_raman.chH A D03-May-20221.2 KiB3935

gb_raman.wH A D01-Nov-199630.7 KiB725644

gb_rand.chH A D03-May-20223.3 KiB9287

gb_rand.wH A D28-Jun-200423 KiB587523

gb_roget.chH A D03-May-2022728 2220

gb_roget.wH A D13-Sep-19948.8 KiB230195

gb_save.chH A D03-May-20221.8 KiB8272

gb_save.wH A D18-Dec-199632.8 KiB884782

gb_sort.chH A D03-May-2022222 1311

gb_sort.wH A D13-Sep-19947.4 KiB184157

gb_types.wH A D21-Jun-1993155 97

gb_words.chH A D03-May-20221.1 KiB4843

gb_words.wH A D13-Sep-199421.2 KiB556485

girth.chH A D03-May-202236 65

girth.wH A D01-Nov-199613.9 KiB339302

homer.datH A D15-Jun-199329.3 KiB676674

huck.datH A D15-Jun-19934.1 KiB124122

jean.datH A D25-Mar-20078.3 KiB443441

ladders.chH A D03-May-20221.1 KiB6254

ladders.wH A D29-Dec-200015.6 KiB408350

lisa.datH A D26-Mar-2007112.1 KiB1,8061,805

miles.datH A D16-Feb-199540.6 KiB702701

miles_span.chH A D03-May-20224.3 KiB183163

miles_span.wH A D29-Mar-200568.4 KiB1,7451,553

multiply.chH A D03-May-2022706 3027

multiply.wH A D30-Aug-199310.1 KiB311277

queen.chH A D03-May-202236 65

queen.wH A D30-Aug-19932 KiB5245

queen_wrap.chH A D30-Aug-19934.5 KiB9683

roget.datH A D15-Jun-199332.4 KiB1,0391,038

roget_components.chH A D03-May-2022304 109

roget_components.wH A D11-Jul-200517.4 KiB399340

sample.correctH A D21-Aug-19994.2 KiB122105

take_risc.chH A D03-May-2022304 109

take_risc.wH A D30-Aug-19936.6 KiB174155

test.correctH A D14-Jun-1992841 116115

test.datH A D15-Jun-1993389 97

test_sample.chH A D03-May-20221.9 KiB6257

test_sample.wH A D30-Aug-199310.5 KiB275239

word_components.chH A D03-May-202236 65

word_components.wH A D16-Jun-19934.6 KiB128113

word_giant.chH A D15-Jun-19934.4 KiB126115

words.datH A D15-Jun-199369 KiB5,7635,762

README

1LATE-BREAKING NEWS APPEARS AT THE END OF THIS FILE!
2
3The Stanford GraphBase is copyright 1993 by Stanford University
4
5These files may be freely copied and distributed, provided that
6no changes whatsoever are made. All users are asked to help keep
7the Stanford GraphBase sources consistent and ``uncorrupted,''
8identical everywhere in the world. Changes are permissible only
9if the changed file is given a new name, different from the names of
10existing files listed below, and only if the changed file is
11clearly identified as not being part of the Stanford GraphBase.
12The author has tried his best to produce correct and useful programs,
13in order to help promote computer science research, but no warranty
14of any kind should be assumed.
15
16FILES INCLUDED IN STANDARD GRAPHBASE DISTRIBUTION
17
18The standard Stanford GraphBase consists of the following files:
19
201) Data files
21      anna.dat     Anna Karenina (used by gb_books)
22      david.dat    David Copperfield (used by gb_books)
23      econ.dat     US economic input and output (used by gb_econ)
24      games.dat    College football scores, 1990 (used by gb_games)
25      homer.dat    The Iliad (used by gb_books)
26      huck.dat     Huckleberry Finn (used by gb_books)
27      jean.dat     Les Miserables (used by gb_books)
28      lisa.dat     Mona Lisa pixels (used by gb_lisa)
29      miles.dat    Mileage between North American cities (used by gb_miles)
30      roget.dat    Cross references in Roget's Thesaurus (used by gb_roget)
31      words.dat    Five-letter words of English (used by (gb_words)
322) CWEB program files
33  a) Kernel routines
34      gb_flip.w    System-independent random number generator
35      gb_graph.w   Data structures for graphs
36      gb_io.w      Input/output routines
37      gb_sort.w    Sorting routine for linked lists
38  b) Graph generating routines
39      gb_basic.w   Standard building blocks and graph operations
40      gb_books.w   Graphs based on world literature
41      gb_econ.w    Graphs based on US inter-industry flow
42      gb_games.w   Graphs based on college football games
43      gb_gates.w   Graphs based on combinational logic
44      gb_lisa.w    Graphs based on Leonardo's Mona Lisa
45      gb_miles.w   Graphs based on highway distances
46      gb_plane.w   Planar graphs
47      gb_raman.w   Ramanujan graphs (expanders)
48      gb_rand.w    Random graphs
49      gb_roget.w   Graphs based on Roget's Thesaurus
50      gb_words.w   Graphs based on 5-letter words of English
51   c) Demonstration routines
52      assign_lisa.w      The assignment problem, using Mona Lisa
53      book_components.w  Biconnected components, using the plots of books
54      econ_order.w       Heuristic solution to an optimum permutation problem
55      football.w         Heuristic solution to a longest-path problem
56      girth.w            Empirical study of Ramanujan graphs
57      ladders.w          Shortest paths in word graphs
58      miles_span.w       Comparison of algorithms for minimum spanning tree
59      multiply.w         Using a parallel multiplication circuit
60      queen.w            Graphs based on queen moves
61      roget_components.w Strong components of a directed graph
62      take_risc.w        Using a simple RISC computer circuit
63      word_components.w  Connected components of word graphs
64   d) Miscellaneous routines
65      boilerplate.w      Legalese incorporated into all GraphBase programs
66      gb_dijk.w          Variants of Dijkstra's algorithm for shortest paths
67      gb_save.w          Converting graphs to ASCII files and vice versa
68      gb_types.w         GraphBase reserved word formatting (used with @i)
69      test_sample.w      Test routine for GraphBase installation
703) Miscellaneous files
71      Makefile           Instructions to build everything with UNIX
72      README             What you're now reading
73      abstract.plaintex  Short explanation of what it's all about
74      cities.texmap      TeXable map of the 128 cities in miles.dat
75      queen_wrap.ch      Demonstration changefile
76      sample.correct     Correct primary output of test_sample
77      test.correct       Correct secondary output of test_sample
78      test.dat           Weird data used to test gb_io
79      word_giant.ch      Another demonstration changefile
80      blank.w            Template to copy when writing a new CWEB program
81      +The+Stanford+GraphBase+  Empty file at beginning of directory listing
82
83TO INSTALL THESE PROGRAMS
84
85First install CWEB (version 3.0 or greater), which can be found in various
86archives; the master files reside at ftp.cs.stanford.edu.  Then, on a
87UNIX-like system, edit the Makefile as Makefile instructs you, take a deep
88breath, and "make tests". After you get the message
89      Congratulations --- the tests have all been passed
90you can then say "make install" (possibly changing to superuser if the
91directories are protected). On other systems, build the programs yourself
92by following the recipes in Makefile as closely as you can.
93
94On a UNIX-like system, the process of building everything should produce
95roughly the following actions (possibly with harmless warning messages):
96ctangle gb_io.w
97cc -g -I$INCLUDEDIR  -DDATA_DIRECTORY=\"$DATADIR/\" -c gb_io.c
98cc -g -I$INCLUDEDIR  test_io.c gb_io.o -o test_io
99ctangle gb_graph.w
100cc -g -I$INCLUDEDIR  -c  gb_graph.c
101cc -g -I$INCLUDEDIR  test_graph.c gb_graph.o -o test_graph
102ctangle gb_flip.w
103cc -g -I$INCLUDEDIR  -c  gb_flip.c
104cc -g -I$INCLUDEDIR  test_flip.c gb_flip.o -o test_flip
105test_io
106OK, the gb_io routines seem to work!
107test_graph
108Hey, I allocated 10000000 bytes successfully. Terrific...
109OK, the gb_graph routines seem to work!
110test_flip
111OK, the gb_flip routines seem to work!
112ctangle gb_sort.w
113cc -g -I$INCLUDEDIR  -c  gb_sort.c
114ctangle gb_basic.w
115cc -g -I$INCLUDEDIR  -c  gb_basic.c
116ctangle gb_books.w
117cc -g -I$INCLUDEDIR  -c  gb_books.c
118ctangle gb_econ.w
119cc -g -I$INCLUDEDIR  -c  gb_econ.c
120ctangle gb_games.w
121cc -g -I$INCLUDEDIR  -c  gb_games.c
122ctangle gb_gates.w
123cc -g -I$INCLUDEDIR  -c  gb_gates.c
124ctangle gb_lisa.w
125cc -g -I$INCLUDEDIR  -c  gb_lisa.c
126ctangle gb_miles.w
127cc -g -I$INCLUDEDIR  -c  gb_miles.c
128ctangle gb_plane.w
129cc -g -I$INCLUDEDIR  -c  gb_plane.c
130ctangle gb_raman.w
131cc -g -I$INCLUDEDIR  -c  gb_raman.c
132ctangle gb_rand.w
133cc -g -I$INCLUDEDIR  -c  gb_rand.c
134ctangle gb_roget.w
135cc -g -I$INCLUDEDIR  -c  gb_roget.c
136ctangle gb_words.w
137cc -g -I$INCLUDEDIR  -c  gb_words.c
138ctangle gb_dijk.w
139cc -g -I$INCLUDEDIR  -c  gb_dijk.c
140ctangle gb_save.w
141cc -g -I$INCLUDEDIR  -c  gb_save.c
142rm -rf certified
143ar rcv libgb.a gb_flip.o gb_graph.o gb_io.o gb_sort.o gb_basic.o gb_books.o \
144  gb_econ.o gb_games.o gb_gates.o  gb_lisa.o gb_miles.o gb_plane.o gb_raman.o \
145  gb_rand.o gb_roget.o  gb_words.o gb_dijk.o gb_save.o
146ranlib libgb.a
147ctangle test_sample.w
148cc -g -I$INCLUDEDIR   -L. -L$LIBDIR -o test_sample test_sample.c -lgb
149test_sample > sample.out
150diff test.gb test.correct
151diff sample.out sample.correct
152rm test.gb sample.out test_io test_graph test_flip test_sample
153echo "Congratulations --- the tests have all been passed."
154touch certified
155mkdir $SGBDIR
156mkdir $DATADIR
157cp -p anna.dat david.dat econ.dat games.dat homer.dat huck.dat jean.dat \
158  lisa.dat miles.dat roget.dat words.dat $DATADIR
159mkdir $LIBDIR
160cp libgb.a $LIBDIR
161mkdir $CWEBINPUTS
162cp -p boilerplate.w gb_types.w $CWEBINPUTS
163mkdir $INCLUDEDIR
164cp -p gb_flip.h gb_graph.h gb_io.h gb_sort.h gb_basic.h gb_books.h gb_econ.h \
165  gb_games.h gb_gates.h  gb_lisa.h gb_miles.h gb_plane.h gb_raman.h gb_rand.h \
166  gb_roget.h  gb_words.h gb_dijk.h gb_save.h Makefile $INCLUDEDIR
167
168Here "ctangle foo" is actually an abbreviation for the shell command
169 "if test -r foo.ch; then ctangle foo.w foo.ch; else ctangle foo; fi"
170which supplies a change file to ctangle if you have prepared one.
171
172(The actions following "touch certified" are those of "make install", assuming
173that "make tests" was done first; these are the only actions that may need
174to be done as superuser. It's generally best not to be superuser until AFTER
175the tests have been passed; otherwise who knows what might happen?)
176
177If you want to install all the demonstration programs as well as the
178GraphBase library, say "make installdemos" after "make install". This
179causes the following sequence of actions to occur:
180ctangle assign_lisa.w
181cc -g -I$INCLUDEDIR -L. -L$LIBDIR -o assign_lisa assign_lisa.c -lgb
182make book_components.c
183ctangle book_components.w
184cc -g -I$INCLUDEDIR -L. -L$LIBDIR -o book_components book_components.c -lgb
185ctangle econ_order.w
186cc -g -I$INCLUDEDIR -L. -L$LIBDIR -o econ_order econ_order.c -lgb
187ctangle football.w
188cc -g -I$INCLUDEDIR -L. -L$LIBDIR -o football football.c -lgb
189ctangle girth.w
190cc -g -I$INCLUDEDIR -L. -L$LIBDIR -o girth girth.c -lgb
191ctangle ladders.w
192cc -g -I$INCLUDEDIR -L. -L$LIBDIR -o ladders ladders.c -lgb
193ctangle miles_span.w
194cc -g -I$INCLUDEDIR -L. -L$LIBDIR -o miles_span miles_span.c -lgb
195ctangle multiply.w
196cc -g -I$INCLUDEDIR -L. -L$LIBDIR -o multiply multiply.c -lgb
197ctangle queen.w
198cc -g -I$INCLUDEDIR -L. -L$LIBDIR -o queen queen.c -lgb
199ctangle roget_components.w
200cc -g -I$INCLUDEDIR -L. -L$LIBDIR -o roget_components roget_components.c -lgb
201ctangle take_risc.w
202cc -g -I$INCLUDEDIR -L. -L$LIBDIR -o take_risc take_risc.c -lgb
203ctangle word_components.w
204cc -g -I$INCLUDEDIR -L. -L$LIBDIR -o word_components word_components.c -lgb
205mkdir $BINDIR
206mv assign_lisa book_components econ_order football girth ladders miles_span \
207  multiply queen roget_components  take_risc word_components $BINDIR
208
209Complete instructions appear in the book by D. E. Knuth entitled
210 The Stanford GraphBase: A Platform for Combinatorial Computing
211published jointly by ACM Press and Addison-Wesley (1993), ISBN 0-201-54275-7.
212
213IF ALL ELSE FAILS send trouble reports to sgb@cs.stanford.edu.
214IF YOU LIKE THE STANFORD GRAPHBASE send thanks to sgb@cs.stanford.edu.
215
216******LATE-BREAKING NEWS:
217
218* The master sources at ftp.cs.stanford.edu contain all the files listed above
219(uncompressed), as well as a compressed file sgb.tar.gz that generates them on
220a UNIX system if you say "zcat sgb.tar.gz | tar xvpf -" using GNU's excellent
221new compression/decompression scheme.
222
223* The master sources also contain an ERRATA file listing all known errors
224in the GraphBase book. (A reward of $2.56 is paid to the first finder of
225an error; the errors listed in ERRATA are no longer worth anything.)
226
227* Although several of the GraphBase programs have changed since the system
228was first released, only one of those changes has affected the generated
229graphs. (This was an embarrassing correction to gb_rand.w, noted in
230the errata for page 388; it affects some instances of random_graph
231and random_bigraph, which therefore are no longer identical to the
232graphs of the same identifier obtained before June 1999.) Otherwise,
233corrections were only made to improve comments or to remove anomalies
234in cases where some compilers had difficulty.
235
236* The demonstration programs sometimes return a negative value to the
237operating system environment. For example, an error message about improper
238"Usage:" is often followed by "return -2". The actual number received by
239a shell script or makefile running such programs will differ on different
240operating systems (and in particular a negative number will often be converted
241to a nonnegative 8-bit integer). The returned values have no great importance;
242they are intended only for debugging.
243
244* It is planned to have subdirectories that contain change files for systems
245that are particularly hard to accommodate. For example, a "DOS" subdirectory
246might be provided for a certain well-known operating system. We will try
247to give UPPERCASE names to such subdirectories so that they are easily spotted.
248
249* Important note: The Stanford GraphBase programs do not obey the ANSI C
250standard restriction on comparison of pointers. In fact, the author (Knuth)
251confesses to being unaware until recently that such a restriction was
252part of the standard; he wrote the code under the assumption that
253pointers were essentially machine addresses. No problem occurs with
254respect to |==| and |!=| comparison, but the code sometimes has a loop
255like |for (p=hi;p>=lo;p--)| where |lo| is the base address of a
256dynamically allocated array. Strictly speaking, |lo-1| is undefined.
257In other places (e.g., sections 23 and 26 of GB_SAVE) we explicitly test
258if one pointer is less than another; this code effectively sorts a set of
259pointers of unknown origin by magnitude, so it assumes that |<| defines a
260total ordering on pointers. In GB_GATES section 2 we cast a pointer
261to unsigned long and test whether the result is |<=1|; conversely, the
262constant 1 is read as a pointer via a union type in GB_SAVE section 10.
263
264None of this is likely to cause any trouble unless your environment has
265segmented architecture and 16-bit offsets within each segment. If you do
266have such a system, your best bet is probably to get one of the free
267and excellent ports of the GCC compiler. For example, DJ Delorie has
268succeeded in porting GCC to the MSDOS environment. Alternatively,
269a set of change files appears on directory sgb/ANSI.
270
271* The code also assumes throughout that NULL is equivalent to zero (for
272example, that pointer arrays delivered by |calloc| are full of NULLs).
273It would be almost impossible to remove this assumption; don't even
274think about it.
275

README.PROTOTYPES

1This file, ./PROTOTYPES/README.PROTOTYPES, is NOT part of the standard
2distribution of the Stanford GraphBase.
3
4
5COPYRIGHT NOTICE FOR ./PROTOTYPES
6
7The following copyright notice extends to all files in the ./PROTOTYPES
8subdirectory, but not to any part of the standard distribution of the
9Stanford GraphBase (which is copyright (c) 1993 by Stanford University).
10
11Copyright (c) 1994, 1996 Andreas Scherer
12
13Permission is granted to make and distribute verbatim copies of this
14document provided that the copyright notice and this permission notice are
15preserved on all copies.
16
17Permission is granted to copy and distribute modified versions of this
18document under the conditions for verbatim copying, provided that the
19entire resulting derived work is distributed under the terms of a
20permission notice identical to this one.
21
22
23PURPOSE OF THIS FILE
24
25It describes the contents of the subdirectory ./PROTOTYPES, where `.'
26denotes the root directory of the standard installation of SGB.
27
28
29PURPOSE OF ./PROTOTYPES
30
31The additional subdirectory ./PROTOTYPES contains a set of change files for
32improved ANSI support, including all changes by Marc van Leeuwen as
33provided in the ./ANSI subdirectory, by implementing function declarations
34and function definitions in the form of `prototypes'.
35
36Normally I dislike to ignore or suppress warning messages from the compiler
37and/or the linker.  For the sake of simplicity, the first attempt to
38install SGB on the Commodore AMIGA resulted in the ./AMIGA subdirectory,
39which contains only two (2) extra files.  BUT:  The CFLAGS macro in
40./AMIGA/SMakefile has the entry "IGNORE=85+93+100+132+154+161" because of
41the missing prototypes in the original source files.
42
43The independent change files in ./PROTOTYPES take care of all these
44omissions, thus reducing the IGNORE variable to the single value `93';
45this effects the section @<Vanilla local variables@> in ./gb_basic.w only.
46
47The patches in ./PROTOTYPES effect all of the kernel and library modules and
48some demonstration programs.  To make use of these patches a special version
49of ./AMIGA/SMakefile is provided (development and test of these patches were
50done on a Commodore AMIGA with the help of SAS/C++ 6.56).
51
52./PROTOTYPES/assign_lisa.ch
53./PROTOTYPES/book_components.ch
54./PROTOTYPES/econ_order.ch
55./PROTOTYPES/football.ch
56./PROTOTYPES/gb_basic.ch
57./PROTOTYPES/gb_books.ch
58./PROTOTYPES/gb_dijk.ch
59./PROTOTYPES/gb_econ.ch
60./PROTOTYPES/gb_flip.ch
61./PROTOTYPES/gb_games.ch
62./PROTOTYPES/gb_gates.ch
63./PROTOTYPES/gb_graph.ch
64./PROTOTYPES/gb_io.ch
65./PROTOTYPES/gb_lisa.ch
66./PROTOTYPES/gb_miles.ch
67./PROTOTYPES/gb_plane.ch
68./PROTOTYPES/gb_raman.ch
69./PROTOTYPES/gb_rand.ch
70./PROTOTYPES/gb_roget.ch
71./PROTOTYPES/gb_save.ch
72./PROTOTYPES/gb_sort.ch
73./PROTOTYPES/gb_words.ch
74./PROTOTYPES/girth.ch
75./PROTOTYPES/ladders.ch
76./PROTOTYPES/miles_span.ch
77./PROTOTYPES/multiply.ch
78./PROTOTYPES/queen.ch
79./PROTOTYPES/README.PROTOTYPES
80./PROTOTYPES/roget_components.ch
81./PROTOTYPES/SMakefile
82./PROTOTYPES/take_risc.ch
83./PROTOTYPES/test_sample.ch
84./PROTOTYPES/word_components.ch
85
86
87HOW TO USE THESE PATCHES
88
89Copy the contents of ./PROTOTYPES to the root directory of the standard SGB
90installation.  Care has been taken to avoid any collisions with existing
91files in the root directory.  Then say "make tests", "make install",
92"make installdemos", and "make clean", in this order as described in
93./README.  To date this holds for AMIGA users only, but support of other
94operating systems and compilers is easy; the original UNIX ./Makefile
95already contains provisions for the presence of change files and will
96acknowledge the files from ./PROTOTYPES automatically.
97
98
99TROUBLE SHOOTING
100
101Should you encounter problems with this patch for SGB or should you have
102ideas for further improvements contact the author of this contribution
103
104Andreas Scherer
105Rochusstra�e 22-24
10652062 Aachen, Germany
107<andreas.scherer@pobox.com>
108