#!/bin/sh
# This is a shell archive (produced by GNU sharutils 4.2.1).
# To extract the files from this archive, save it to some FILE, remove
# everything before the `!/bin/sh' line above, then type `sh FILE'.
#
# Made on 2004-11-13 23:16 PST by .
# Source directory was `/home/knoppix/graph/release'.
#
# Existing files will *not* be overwritten unless `-c' is specified.
#
# This shar contains:
# length mode name
# ------ ---------- ------------------------------------------
# 18009 -rw-r----- COPYING
# 427 -rw-r----- Makefile
# 2402 -rw-r----- README
# 37595 -rw-r----- graph.c
#
save_IFS="${IFS}"
IFS="${IFS}:"
gettext_dir=FAILED
locale_dir=FAILED
first_param="$1"
for dir in $PATH
do
if test "$gettext_dir" = FAILED && test -f $dir/gettext \
&& ($dir/gettext --version >/dev/null 2>&1)
then
set `$dir/gettext --version 2>&1`
if test "$3" = GNU
then
gettext_dir=$dir
fi
fi
if test "$locale_dir" = FAILED && test -f $dir/shar \
&& ($dir/shar --print-text-domain-dir >/dev/null 2>&1)
then
locale_dir=`$dir/shar --print-text-domain-dir`
fi
done
IFS="$save_IFS"
if test "$locale_dir" = FAILED || test "$gettext_dir" = FAILED
then
echo=echo
else
TEXTDOMAINDIR=$locale_dir
export TEXTDOMAINDIR
TEXTDOMAIN=sharutils
export TEXTDOMAIN
echo="$gettext_dir/gettext -s"
fi
if touch -am -t 200112312359.59 $$.touch >/dev/null 2>&1 && test ! -f 200112312359.59 -a -f $$.touch; then
shar_touch='touch -am -t $1$2$3$4$5$6.$7 "$8"'
elif touch -am 123123592001.59 $$.touch >/dev/null 2>&1 && test ! -f 123123592001.59 -a ! -f 123123592001.5 -a -f $$.touch; then
shar_touch='touch -am $3$4$5$6$1$2.$7 "$8"'
elif touch -am 1231235901 $$.touch >/dev/null 2>&1 && test ! -f 1231235901 -a -f $$.touch; then
shar_touch='touch -am $3$4$5$6$2 "$8"'
else
shar_touch=:
echo
$echo 'WARNING: not restoring timestamps. Consider getting and'
$echo "installing GNU \`touch', distributed in GNU File Utilities..."
echo
fi
rm -f 200112312359.59 123123592001.59 123123592001.5 1231235901 $$.touch
#
if mkdir _sh02480; then
$echo 'x -' 'creating lock directory'
else
$echo 'failed to create lock directory'
exit 1
fi
# ============= COPYING ==============
if test -f 'COPYING' && test "$first_param" != -c; then
$echo 'x -' SKIPPING 'COPYING' '(file already exists)'
else
$echo 'x -' extracting 'COPYING' '(text)'
sed 's/^X//' << 'SHAR_EOF' > 'COPYING' &&
X GNU GENERAL PUBLIC LICENSE
X Version 2, June 1991
X
X Copyright (C) 1989, 1991 Free Software Foundation, Inc.
X 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
X Everyone is permitted to copy and distribute verbatim copies
X of this license document, but changing it is not allowed.
X
X Preamble
X
X The licenses for most software are designed to take away your
freedom to share and change it. By contrast, the GNU General Public
License is intended to guarantee your freedom to share and change free
software--to make sure the software is free for all its users. This
General Public License applies to most of the Free Software
Foundation's software and to any other program whose authors commit to
using it. (Some other Free Software Foundation software is covered by
the GNU Library General Public License instead.) You can apply it to
your programs, too.
X
X When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
this service if you wish), that you receive source code or can get it
if you want it, that you can change the software or use pieces of it
in new free programs; and that you know you can do these things.
X
X To protect your rights, we need to make restrictions that forbid
anyone to deny you these rights or to ask you to surrender the rights.
These restrictions translate to certain responsibilities for you if you
distribute copies of the software, or if you modify it.
X
X For example, if you distribute copies of such a program, whether
gratis or for a fee, you must give the recipients all the rights that
you have. You must make sure that they, too, receive or can get the
source code. And you must show them these terms so they know their
rights.
X
X We protect your rights with two steps: (1) copyright the software, and
(2) offer you this license which gives you legal permission to copy,
distribute and/or modify the software.
X
X Also, for each author's protection and ours, we want to make certain
that everyone understands that there is no warranty for this free
software. If the software is modified by someone else and passed on, we
want its recipients to know that what they have is not the original, so
that any problems introduced by others will not reflect on the original
authors' reputations.
X
X Finally, any free program is threatened constantly by software
patents. We wish to avoid the danger that redistributors of a free
program will individually obtain patent licenses, in effect making the
program proprietary. To prevent this, we have made it clear that any
patent must be licensed for everyone's free use or not licensed at all.
X
X The precise terms and conditions for copying, distribution and
modification follow.
X
X GNU GENERAL PUBLIC LICENSE
X TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
X
X 0. This License applies to any program or other work which contains
a notice placed by the copyright holder saying it may be distributed
under the terms of this General Public License. The "Program", below,
refers to any such program or work, and a "work based on the Program"
means either the Program or any derivative work under copyright law:
that is to say, a work containing the Program or a portion of it,
either verbatim or with modifications and/or translated into another
language. (Hereinafter, translation is included without limitation in
the term "modification".) Each licensee is addressed as "you".
X
Activities other than copying, distribution and modification are not
covered by this License; they are outside its scope. The act of
running the Program is not restricted, and the output from the Program
is covered only if its contents constitute a work based on the
Program (independent of having been made by running the Program).
Whether that is true depends on what the Program does.
X
X 1. You may copy and distribute verbatim copies of the Program's
source code as you receive it, in any medium, provided that you
conspicuously and appropriately publish on each copy an appropriate
copyright notice and disclaimer of warranty; keep intact all the
notices that refer to this License and to the absence of any warranty;
and give any other recipients of the Program a copy of this License
along with the Program.
X
You may charge a fee for the physical act of transferring a copy, and
you may at your option offer warranty protection in exchange for a fee.
X
X 2. You may modify your copy or copies of the Program or any portion
of it, thus forming a work based on the Program, and copy and
distribute such modifications or work under the terms of Section 1
above, provided that you also meet all of these conditions:
X
X a) You must cause the modified files to carry prominent notices
X stating that you changed the files and the date of any change.
X
X b) You must cause any work that you distribute or publish, that in
X whole or in part contains or is derived from the Program or any
X part thereof, to be licensed as a whole at no charge to all third
X parties under the terms of this License.
X
X c) If the modified program normally reads commands interactively
X when run, you must cause it, when started running for such
X interactive use in the most ordinary way, to print or display an
X announcement including an appropriate copyright notice and a
X notice that there is no warranty (or else, saying that you provide
X a warranty) and that users may redistribute the program under
X these conditions, and telling the user how to view a copy of this
X License. (Exception: if the Program itself is interactive but
X does not normally print such an announcement, your work based on
X the Program is not required to print an announcement.)
X
These requirements apply to the modified work as a whole. If
identifiable sections of that work are not derived from the Program,
and can be reasonably considered independent and separate works in
themselves, then this License, and its terms, do not apply to those
sections when you distribute them as separate works. But when you
distribute the same sections as part of a whole which is a work based
on the Program, the distribution of the whole must be on the terms of
this License, whose permissions for other licensees extend to the
entire whole, and thus to each and every part regardless of who wrote it.
X
Thus, it is not the intent of this section to claim rights or contest
your rights to work written entirely by you; rather, the intent is to
exercise the right to control the distribution of derivative or
collective works based on the Program.
X
In addition, mere aggregation of another work not based on the Program
with the Program (or with a work based on the Program) on a volume of
a storage or distribution medium does not bring the other work under
the scope of this License.
X
X 3. You may copy and distribute the Program (or a work based on it,
under Section 2) in object code or executable form under the terms of
Sections 1 and 2 above provided that you also do one of the following:
X
X a) Accompany it with the complete corresponding machine-readable
X source code, which must be distributed under the terms of Sections
X 1 and 2 above on a medium customarily used for software interchange; or,
X
X b) Accompany it with a written offer, valid for at least three
X years, to give any third party, for a charge no more than your
X cost of physically performing source distribution, a complete
X machine-readable copy of the corresponding source code, to be
X distributed under the terms of Sections 1 and 2 above on a medium
X customarily used for software interchange; or,
X
X c) Accompany it with the information you received as to the offer
X to distribute corresponding source code. (This alternative is
X allowed only for noncommercial distribution and only if you
X received the program in object code or executable form with such
X an offer, in accord with Subsection b above.)
X
The source code for a work means the preferred form of the work for
making modifications to it. For an executable work, complete source
code means all the source code for all modules it contains, plus any
associated interface definition files, plus the scripts used to
control compilation and installation of the executable. However, as a
special exception, the source code distributed need not include
anything that is normally distributed (in either source or binary
form) with the major components (compiler, kernel, and so on) of the
operating system on which the executable runs, unless that component
itself accompanies the executable.
X
If distribution of executable or object code is made by offering
access to copy from a designated place, then offering equivalent
access to copy the source code from the same place counts as
distribution of the source code, even though third parties are not
compelled to copy the source along with the object code.
X
X 4. You may not copy, modify, sublicense, or distribute the Program
except as expressly provided under this License. Any attempt
otherwise to copy, modify, sublicense or distribute the Program is
void, and will automatically terminate your rights under this License.
However, parties who have received copies, or rights, from you under
this License will not have their licenses terminated so long as such
parties remain in full compliance.
X
X 5. You are not required to accept this License, since you have not
signed it. However, nothing else grants you permission to modify or
distribute the Program or its derivative works. These actions are
prohibited by law if you do not accept this License. Therefore, by
modifying or distributing the Program (or any work based on the
Program), you indicate your acceptance of this License to do so, and
all its terms and conditions for copying, distributing or modifying
the Program or works based on it.
X
X 6. Each time you redistribute the Program (or any work based on the
Program), the recipient automatically receives a license from the
original licensor to copy, distribute or modify the Program subject to
these terms and conditions. You may not impose any further
restrictions on the recipients' exercise of the rights granted herein.
You are not responsible for enforcing compliance by third parties to
this License.
X
X 7. If, as a consequence of a court judgment or allegation of patent
infringement or for any other reason (not limited to patent issues),
conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot
distribute so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you
may not distribute the Program at all. For example, if a patent
license would not permit royalty-free redistribution of the Program by
all those who receive copies directly or indirectly through you, then
the only way you could satisfy both it and this License would be to
refrain entirely from distribution of the Program.
X
If any portion of this section is held invalid or unenforceable under
any particular circumstance, the balance of the section is intended to
apply and the section as a whole is intended to apply in other
circumstances.
X
It is not the purpose of this section to induce you to infringe any
patents or other property right claims or to contest validity of any
such claims; this section has the sole purpose of protecting the
integrity of the free software distribution system, which is
implemented by public license practices. Many people have made
generous contributions to the wide range of software distributed
through that system in reliance on consistent application of that
system; it is up to the author/donor to decide if he or she is willing
to distribute software through any other system and a licensee cannot
impose that choice.
X
This section is intended to make thoroughly clear what is believed to
be a consequence of the rest of this License.
X
X 8. If the distribution and/or use of the Program is restricted in
certain countries either by patents or by copyrighted interfaces, the
original copyright holder who places the Program under this License
may add an explicit geographical distribution limitation excluding
those countries, so that distribution is permitted only in or among
countries not thus excluded. In such case, this License incorporates
the limitation as if written in the body of this License.
X
X 9. The Free Software Foundation may publish revised and/or new versions
of the General Public License from time to time. Such new versions will
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
X
Each version is given a distinguishing version number. If the Program
specifies a version number of this License which applies to it and "any
later version", you have the option of following the terms and conditions
either of that version or of any later version published by the Free
Software Foundation. If the Program does not specify a version number of
this License, you may choose any version ever published by the Free Software
Foundation.
X
X 10. If you wish to incorporate parts of the Program into other free
programs whose distribution conditions are different, write to the author
to ask for permission. For software which is copyrighted by the Free
Software Foundation, write to the Free Software Foundation; we sometimes
make exceptions for this. Our decision will be guided by the two goals
of preserving the free status of all derivatives of our free software and
of promoting the sharing and reuse of software generally.
X
X NO WARRANTY
X
X 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
REPAIR OR CORRECTION.
X
X 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGES.
X
X END OF TERMS AND CONDITIONS
X
X How to Apply These Terms to Your New Programs
X
X If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.
X
X To do so, attach the following notices to the program. It is safest
to attach them to the start of each source file to most effectively
convey the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.
X
X
X Copyright (C)
X
X This program is free software; you can redistribute it and/or modify
X it under the terms of the GNU General Public License as published by
X the Free Software Foundation; either version 2 of the License, or
X (at your option) any later version.
X
X This program is distributed in the hope that it will be useful,
X but WITHOUT ANY WARRANTY; without even the implied warranty of
X MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
X GNU General Public License for more details.
X
X You should have received a copy of the GNU General Public License
X along with this program; if not, write to the Free Software
X Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
X
X
Also add information on how to contact you by electronic and paper mail.
X
If the program is interactive, make it output a short notice like this
when it starts in an interactive mode:
X
X Gnomovision version 69, Copyright (C) year name of author
X Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
X This is free software, and you are welcome to redistribute it
X under certain conditions; type `show c' for details.
X
The hypothetical commands `show w' and `show c' should show the appropriate
parts of the General Public License. Of course, the commands you use may
be called something other than `show w' and `show c'; they could even be
mouse-clicks or menu items--whatever suits your program.
X
You should also get your employer (if you work as a programmer) or your
school, if any, to sign a "copyright disclaimer" for the program, if
necessary. Here is a sample; alter the names:
X
X Yoyodyne, Inc., hereby disclaims all copyright interest in the program
X `Gnomovision' (which makes passes at compilers) written by James Hacker.
X
X , 1 April 1989
X Ty Coon, President of Vice
X
This General Public License does not permit incorporating your program into
proprietary programs. If your program is a subroutine library, you may
consider it more useful to permit linking proprietary applications with the
library. If this is what you want to do, use the GNU Library General
Public License instead of this License.
SHAR_EOF
(set 20 04 11 13 18 47 28 'COPYING'; eval "$shar_touch") &&
chmod 0640 'COPYING' ||
$echo 'restore of' 'COPYING' 'failed'
if ( md5sum --help 2>&1 | grep 'sage: md5sum \[' ) >/dev/null 2>&1 \
&& ( md5sum --version 2>&1 | grep -v 'textutils 1.12' ) >/dev/null; then
md5sum -c << SHAR_EOF >/dev/null 2>&1 \
|| $echo 'COPYING:' 'MD5 check failed'
393a5ca445f6965873eca0259a17f833 COPYING
SHAR_EOF
else
shar_count="`LC_ALL= LC_CTYPE= LANG= wc -c < 'COPYING'`"
test 18009 -eq "$shar_count" ||
$echo 'COPYING:' 'original size' '18009,' 'current size' "$shar_count!"
fi
fi
# ============= Makefile ==============
if test -f 'Makefile' && test "$first_param" != -c; then
$echo 'x -' SKIPPING 'Makefile' '(file already exists)'
else
$echo 'x -' extracting 'Makefile' '(text)'
sed 's/^X//' << 'SHAR_EOF' > 'Makefile' &&
CC = gcc
# CFLAGS = -g
CFLAGS = -O3 -g -Wall -ansi -pedantic
LIBS =
X
all: graph
X
graph: graph.c
X $(CC) $(CFLAGS) -DHASH -o graph graph.c $(LIBS)
X
shar: COPYING Makefile README graph.c
X shar COPYING Makefile README graph.c >graph.shar
X
zip: COPYING Makefile README graph.c
X zip graph.zip COPYING Makefile README graph.c
X
tgz: COPYING Makefile README graph.c
X tar cvf graph.tar COPYING Makefile README graph.c
X gzip graph.tar
SHAR_EOF
(set 20 04 11 13 23 16 31 'Makefile'; eval "$shar_touch") &&
chmod 0640 'Makefile' ||
$echo 'restore of' 'Makefile' 'failed'
if ( md5sum --help 2>&1 | grep 'sage: md5sum \[' ) >/dev/null 2>&1 \
&& ( md5sum --version 2>&1 | grep -v 'textutils 1.12' ) >/dev/null; then
md5sum -c << SHAR_EOF >/dev/null 2>&1 \
|| $echo 'Makefile:' 'MD5 check failed'
bddc8cfd7a986cb9c8e5841e0237c9c0 Makefile
SHAR_EOF
else
shar_count="`LC_ALL= LC_CTYPE= LANG= wc -c < 'Makefile'`"
test 427 -eq "$shar_count" ||
$echo 'Makefile:' 'original size' '427,' 'current size' "$shar_count!"
fi
fi
# ============= README ==============
if test -f 'README' && test "$first_param" != -c; then
$echo 'x -' SKIPPING 'README' '(file already exists)'
else
$echo 'x -' extracting 'README' '(text)'
sed 's/^X//' << 'SHAR_EOF' > 'README' &&
graph.c
-------
X
This program enumerates simple perfect squared rectangles. Here, a
_squared_rectangle_ is a rectangle dissected into squares. It is _perfect_ if
no two of the squares are the same size, and _imperfect_ otherwise. It is
_simple_ if it contains no smaller squared rectangle, other than its
component squares; if it is not simple, it is _compound_. The number of
squares a squared rectangle is divided into is called its _order_.
X
A squared rectangle can be described by its _Bouwkamp_code_. This code is
obtained by looking at a list of the horizontal segments found in the
squared rectangle, ordered from top to bottom and starting with the top edge,
and making, for each segment, a parenthesized list of the side-lengths of the
squares immediately below the segment, going from left to right.
X
graph.c enumerates all simple perfect squared rectangles with order 20 or
below. Each rectangle's order, size, and Bouwkamp code is printed, one
rectangle to a line. Also, some statistics on graphs used to generate the
rectangles are printed; see below. Some rectangles will be printed more
than once.
X
Method
------
X
According to the seminal paper of Brooks, Smith, Stone, and Tutte
(Duke Math. J., 7 (1940), pp. 312--340, (5.23)), any simple perfect
rectangle can be derived from a 3-connected planar graph in the following
way: some edge of the graph is deleted; the remaining graph is then viewed
as an electrical network by giving each remaining edge a resistance of
one ohm, and applying a unit potential across the pair of vertices the
deleted edge was attached to. Each edge can then be associated with
a square whose size is proportional to the current flowing through the
edge; Kirchoff's laws ensure that these squares can be assembled into
a rectangle.
X
The program enumerates the 3-connected planar graphs by successively
splitting vertices and faces as described in Dillencourt (J. Comb. Theory B,
66 (1), Jan. 1996, pp. 87--122, Thms. 4.1, 4.2), and a unique representative
from each isomorphism class is chosen using the algorithm described in
Hopcroft and Tarjan (J. Computer & System Sciences 7 (1973), pp. 323--331).
For each given number of vertices, edges, and faces, and automorphism group
size, the program prints the number of self-dual and non-self-dual graphs with
these characteristics.
X
X
X
David Moews, 13-XI-2004
dmoews@xraysgi.ims.uconn.edu
SHAR_EOF
(set 20 04 11 13 19 01 22 'README'; eval "$shar_touch") &&
chmod 0640 'README' ||
$echo 'restore of' 'README' 'failed'
if ( md5sum --help 2>&1 | grep 'sage: md5sum \[' ) >/dev/null 2>&1 \
&& ( md5sum --version 2>&1 | grep -v 'textutils 1.12' ) >/dev/null; then
md5sum -c << SHAR_EOF >/dev/null 2>&1 \
|| $echo 'README:' 'MD5 check failed'
e263b7d0a3f3c0058f99bfc751cc6fff README
SHAR_EOF
else
shar_count="`LC_ALL= LC_CTYPE= LANG= wc -c < 'README'`"
test 2402 -eq "$shar_count" ||
$echo 'README:' 'original size' '2402,' 'current size' "$shar_count!"
fi
fi
# ============= graph.c ==============
if test -f 'graph.c' && test "$first_param" != -c; then
$echo 'x -' SKIPPING 'graph.c' '(file already exists)'
else
$echo 'x -' extracting 'graph.c' '(text)'
sed 's/^X//' << 'SHAR_EOF' > 'graph.c' &&
/* Copyright (C) 2004 David Moews; all rights reserved. */
X
/*
X * graph.c: simple perfect squared rectangle enumeration.
X * See README for an explanation.
X *
X * This program is free software; you can redistribute it and/or modify
X * it under the terms of the GNU General Public License as published by
X * the Free Software Foundation; either version 2 of the License, or
X * (at your option) any later version.
X *
X * This program is distributed in the hope that it will be useful,
X * but WITHOUT ANY WARRANTY; without even the implied warranty of
X * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
X * GNU General Public License for more details.
X *
X * You should have received a copy of the GNU General Public License
X * along with this program; if not, write to the Free Software
X * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
X *
X */
X
#include
#include
#include
#include
X
#define MAX_SQUARES 50
X
typedef struct
{
X int x, y, sz;
} DissectionSquare;
X
typedef struct
{
X int x, y, n;
X DissectionSquare sq[MAX_SQUARES];
} Dissection;
X
#define MIN(x,y) ((x)>(y)?(y):(x))
X
#define MAX_EDGES 21
#define MAX_DEGREE (MAX_EDGES/2)
/* maxdeg>=n ===> at least n+1 vtcs & dually at least n+1 faces
X ===> |E|>=2n (|V|-|E|+|F|=2) */
#define MAX_VERTEXFACES (2*MAX_EDGES/3) /* 2|E| >= 3|V|, 3|F| */
X
typedef unsigned char byte;
X
/*
X Edge:
X
X vtx 1
X ^
X |
X |
X face 0 | face 1
X |
X |
X |
X vtx 0
X */
X
typedef struct polyhedron
{
X byte n_vfs[2];
X byte n_e;
X byte ptr[2][MAX_VERTEXFACES+1]; /* Index to start of edge list */
X
X byte e_num[2][MAX_EDGES*2]; /* List of edges (CW order) per vtx */
X byte ends[2][MAX_EDGES*2]; /* List of edge ends per vtx */
X
X byte vf_num[MAX_EDGES][2][2]; /* Which vertex/faces are adj to an edge? */
X byte idx[MAX_EDGES][2][2]; /* Where do we appear on v/f edge lists? */
X
X
X struct block *tag[MAX_EDGES][2]; /* For automorphism partition algorithm */
X
X struct polyhedron *next; /* Link together polys */
X int index_number;
X int group_size;
X int is_self_dual;
} Polyhedron;
X
#define P_PTR(p,vf,n) ((p)->ptr[(vf)][(n)])
#define P_DEG(p,vf,n) (P_PTR(p,vf,n+1)-P_PTR(p,vf,n))
#define P_EDGE(p,vf,n,n_e) ((p)->e_num[(vf)][P_PTR(p,vf,n)+(n_e)])
#define P_END(p,vf,n,n_e) ((p)->ends[(vf)][P_PTR(p,vf,n)+(n_e)])
X
int length(Polyhedron *p)
{
X int rv = 0;
X
X for (; p != NULL; p = p->next)
X rv++;
X
X return(rv);
}
X
#define ADD_LIST(list,p) (void)((p)->next = (list), (list) = (p))
X
typedef struct
{
X byte edge;
X byte end;
} Edgeend;
X
int compare_edgeend(const void *a, const void *b)
{
X if (((Edgeend *)a)->edge < ((Edgeend *)b)->edge)
X return(-1);
X if (((Edgeend *)a)->edge > ((Edgeend *)b)->edge)
X return(1);
X if (((Edgeend *)a)->end < ((Edgeend *)b)->end)
X return(-1);
X if (((Edgeend *)a)->end > ((Edgeend *)b)->end)
X return(1);
X return(0);
}
X
int check_polyhedron(const Polyhedron *p)
{
X int vf, v, i, j, e, end, f, e2, end2, f2;
X Edgeend sorted[2*MAX_EDGES];
X
X if (p->n_vfs[0] < 4 || p->n_vfs[1] < 4 || p->n_e < 6 ||
X p->n_vfs[0] > MAX_VERTEXFACES || p->n_vfs[1] > MAX_VERTEXFACES ||
X p->n_e > MAX_EDGES ||
X p->n_vfs[0] + p->n_vfs[1] != p->n_e + 2 ||
X p->ptr[0][p->n_vfs[0]] != p->n_e * 2 ||
X p->ptr[1][p->n_vfs[1]] != p->n_e * 2)
X return(0);
X
X
X /* Each (edge, end) pair should appear 1ce */
X for (vf = 0; vf < 2; vf++)
X {
X j = 0;
X for (v = 0; v < p->n_vfs[vf]; v++)
X {
X if (P_DEG(p, vf, v) < 3 || P_DEG(p, vf, v) > MAX_DEGREE)
X return(0);
X for (i = 0; i < P_DEG(p, vf, v); i++)
X {
X e = P_EDGE(p, vf, v, i);
X end = P_END(p, vf, v, i);
X if (e < 0 || e >= p->n_e || end < 0 || end > 1)
X return(0);
X if (p->vf_num[e][vf][end] != v)
X return(0);
X if (p->idx[e][vf][end] != i)
X return(0);
X sorted[j].edge = e;
X sorted[j++].end = end;
X }
X }
X qsort(sorted, j, sizeof(Edgeend), compare_edgeend);
X for (v = 0, i = 0; i < j; v++, i += 2)
X {
X if (sorted[i].edge != v || sorted[i+1].edge != v)
X return(0);
X if (sorted[i].end != 0 || sorted[i+1].end != 1)
X return(0);
X }
X }
X /*
X * Adjacent edges incident to a vertex should be incident to the same
X * face, & vice versa.
X */
X for (vf = 0; vf < 2; vf++)
X for (v = 0; v < p->n_vfs[vf]; v++)
X for (i = 0; i < P_DEG(p, vf, v); i++)
X {
X e = P_EDGE(p, vf, v, i);
X end = P_END (p, vf, v, i);
X f = p->vf_num[e][!vf][!(vf ^ end)];
X
X e2 = P_EDGE(p, vf, v, (i+1) % P_DEG(p, vf, v));
X end2 = P_END (p, vf, v, (i+1) % P_DEG(p, vf, v));
X f2 = p->vf_num[e2][!vf][vf ^ end2];
X
X if (f != f2)
X return(0);
X }
X return(1);
}
X
static Polyhedron *free_polyhedra = NULL;
X
Polyhedron *new_polyhedron()
{
X Polyhedron *rv;
X
X if (free_polyhedra)
X {
X rv = free_polyhedra;
X free_polyhedra = free_polyhedra->next;
X } else
X {
X rv = (Polyhedron *)malloc(sizeof(Polyhedron));
X assert(rv);
X }
X return(rv);
}
X
void free_polyhedron(Polyhedron *p)
{
X p->next = free_polyhedra;
X free_polyhedra = p;
}
X
/* Resize edge array of P_VF (a VF) to size DEG; fill in with EDGES, ENDS */
void resize(Polyhedron *p, int vf, int p_vf, int deg,
X byte *edges, byte *ends)
{
X int mx = P_PTR(p, vf, p->n_vfs[vf]);
X int i = P_PTR(p, vf, p_vf);
X int i_next = P_PTR(p, vf, p_vf+1);
X int old_deg = i_next - i;
X int delta = deg - old_deg;
X int j;
X
X assert(deg <= MAX_DEGREE);
X
X if (delta < 0)
X {
X for (j = i_next; j < mx; j++)
X {
X p->e_num[vf][j+delta] = p->e_num[vf][j];
X p->ends [vf][j+delta] = p->ends [vf][j];
X }
X } else if (delta > 0)
X {
X for (j = mx - 1; j >= i_next; j--)
X {
X p->e_num[vf][j+delta] = p->e_num[vf][j];
X p->ends [vf][j+delta] = p->ends [vf][j];
X }
X }
X
X for (j = p_vf + 1; j <= p->n_vfs[vf]; j++)
X P_PTR(p, vf, j) += delta;
X
X for (j = 0; j < deg; j++)
X {
X p->e_num[vf][i+j] = edges[j];
X p->ends [vf][i+j] = ends [j];
X }
}
X
/* Stick end SIDE of edge E into list of P_VF (a VF) just after PLACE.
X Adjust IDX[VF][SIDE] and VF_NUM[VF][SIDE] for the edge appropriately.
X */
void insert_after(Polyhedron *p, int vf, int p_vf, int place,
X int e, int side)
{
X int j, i = P_PTR(p, vf, p_vf) + place;
X int mx = P_PTR(p, vf, p->n_vfs[vf]);
X
X assert(P_DEG(p, vf, p_vf) < MAX_DEGREE);
X assert(p->n_e <= MAX_EDGES);
X
X for (j = i + 1; j < P_PTR(p, vf, p_vf + 1); j++)
X p->idx[p->e_num[vf][j]][vf][p->ends[vf][j]]++;
X
X for (j = mx - 1; j > i; j--)
X {
X p->e_num[vf][j+1] = p->e_num[vf][j];
X p->ends [vf][j+1] = p->ends [vf][j];
X }
X
X for (j = p_vf + 1; j <= p->n_vfs[vf]; j++)
X P_PTR(p, vf, j)++;
X
X p->e_num[vf][i+1] = e;
X p->ends [vf][i+1] = side;
X p->vf_num[e][vf][side] = p_vf;
X p->idx [e][vf][side] = place + 1;
}
X
/* Split points are between edges k-1 & k, & between edges l-1 & l */
void make_new_edge(Polyhedron *p, int vf, int split_vf, int k, int l)
{
X byte temp_edge1[MAX_DEGREE], temp_edge2[MAX_DEGREE];
X byte temp_end1[MAX_DEGREE], temp_end2[MAX_DEGREE];
X int deg = P_DEG(p, vf, split_vf);
X int new_edge = p->n_e++;
X int new_vf = p->n_vfs[vf]++;
X int edge_k = P_EDGE(p, vf, split_vf, k);
X int end_k = P_END (p, vf, split_vf, k);
X int edge_l = P_EDGE(p, vf, split_vf, l);
X int end_l = P_END (p, vf, split_vf, l);
X int face_0 = p->vf_num[edge_k][!vf][vf ^ end_k];
X int face_1 = p->vf_num[edge_l][!vf][vf ^ end_l];
X int ind_0 = p->idx [edge_k][!vf][vf ^ end_k];
X int ind_1 = p->idx [edge_l][!vf][vf ^ end_l];
X int i, j0 = 0, j1 = 0;
X
X assert(p->n_e <= MAX_EDGES);
X assert(p->n_vfs[vf] <= MAX_VERTEXFACES);
X
X for (i = l; i != k; )
X {
X int e, end;
X
X temp_edge1[j0] = e = P_EDGE(p, vf, split_vf, i);
X temp_end1 [j0] = end = P_END(p, vf, split_vf, i);
X p->idx[e][vf][end] = j0++;
X if (++i == deg)
X i = 0;
X }
X
X for (; i != l; )
X {
X int e, end;
X
X temp_edge2[j1] = e = P_EDGE(p, vf, split_vf, i);
X temp_end2 [j1] = end = P_END(p, vf, split_vf, i);
X p->vf_num[e][vf][end] = new_vf;
X p->idx[e][vf][end] = j1++;
X if (++i == deg)
X i = 0;
X }
X
X p->vf_num[new_edge][vf][0] = split_vf;
X p->vf_num[new_edge][vf][1] = new_vf;
X p->idx [new_edge][vf][0] = j0;
X p->idx [new_edge][vf][1] = j1;
X
X insert_after(p, !vf, face_0, ind_0, new_edge, vf);
X insert_after(p, !vf, face_1, ind_1, new_edge, !vf);
X
X assert(j0 < MAX_DEGREE);
X temp_edge1[j0] = new_edge;
X temp_end1[j0++] = 0;
X
X assert(j1 < MAX_DEGREE);
X temp_edge2[j1] = new_edge;
X temp_end2[j1++] = 1;
X
X p->ptr[vf][new_vf+1] = p->ptr[vf][new_vf];
X /* No edges initially for new VF */
X resize(p, vf, split_vf, j0, temp_edge1, temp_end1);
X resize(p, vf, new_vf, j1, temp_edge2, temp_end2);
X
X assert(check_polyhedron(p));
}
X
/*
X * Reverse order of all vtx & face adj lists. Must also flip face 0 & 1
X * to preserve edge structure, as above.
X */
void reflect(Polyhedron *p)
{
X int i, j, vf, q, r;
X byte temp;
X
X for (vf = 0; vf < 2; vf++)
X {
X for (i = 0; i < p->n_vfs[vf]; i++)
X {
X for (q = 0, r = P_DEG(p, vf, i) - 1; q < r; q++, r--)
X {
X temp = P_EDGE(p, vf, i, q);
X P_EDGE(p, vf, i, q) = P_EDGE(p, vf, i, r);
X P_EDGE(p, vf, i, r) = temp;
X
X temp = P_END(p, vf, i, q);
X P_END(p, vf, i, q) = P_END(p, vf, i, r);
X P_END(p, vf, i, r) = temp;
X }
X }
X
X for (i = 0; i < p->n_e; i++)
X for (j = 0; j < 2; j++)
X p->idx[i][vf][j] = P_DEG(p, vf, p->vf_num[i][vf][j]) - 1
X - p->idx[i][vf][j];
X }
X
X for (i = 0; i < p->ptr[1][p->n_vfs[1]]; i++)
X p->ends[1][i] = !p->ends[1][i];
X
X for (i = 0; i < p->n_e; i++)
X {
X temp = p->vf_num[i][1][0];
X p->vf_num[i][1][0] = p->vf_num[i][1][1];
X p->vf_num[i][1][1] = temp;
X
X temp = p->idx[i][1][0];
X p->idx[i][1][0] = p->idx[i][1][1];
X p->idx[i][1][1] = temp;
X }
X
X assert(check_polyhedron(p));
}
X
/*
X * Exchange vertices & faces.
X */
void dualize(Polyhedron *p)
{
X int i;
X byte temp;
X
X for (i = 0; i < MAX_VERTEXFACES; i++)
X {
X temp = p->ptr[0][i];
X p->ptr[0][i] = p->ptr[1][i];
X p->ptr[1][i] = temp;
X }
X
X temp = p->n_vfs[0];
X p->n_vfs[0] = p->n_vfs[1];
X p->n_vfs[1] = temp;
X
X for (i = 0; i < 2*p->n_e; i++)
X {
X temp = p->e_num[0][i];
X p->e_num[0][i] = p->e_num[1][i];
X p->e_num[1][i] = temp;
X
X temp = p->ends[0][i];
X p->ends[0][i] = p->ends[1][i];
X p->ends[1][i] = !temp;
X }
X
X for (i = 0; i < p->n_e; i++)
X {
X temp = p->vf_num[i][1][1];
X p->vf_num[i][1][1] = p->vf_num[i][0][0];
X p->vf_num[i][0][0] = p->vf_num[i][1][0];
X p->vf_num[i][1][0] = p->vf_num[i][0][1];
X p->vf_num[i][0][1] = temp;
X
X temp = p->idx[i][1][1];
X p->idx[i][1][1] = p->idx[i][0][0];
X p->idx[i][0][0] = p->idx[i][1][0];
X p->idx[i][1][0] = p->idx[i][0][1];
X p->idx[i][0][1] = temp;
X }
X
X assert(check_polyhedron(p));
}
X
/* Down here, an `edge' will consist of a (polyhedron, edge #, dirn) triple */
X
/*
X * Edge partitioning algorithm for polyhedra:
X *
X * Hopcroft & Tarjan,
X * A V log V algorithm for isomorphism of triconnected planar graphs,
X * J. Computer & System Sciences 7 (1973), pp. 323--331.
X *
X */
X
typedef struct
{
X Polyhedron *p;
X byte e, dir;
} Edge;
X
typedef struct block
{
X Edge e;
X struct block *next, *last; /* Doubly linked list ptrs */
X struct block_hdr *list; /* Which list are we in? */
} Block;
X
typedef struct block_hdr
{
X Block *first; /* List of edges */
X struct block_hdr *next; /* Next list */
X int count; /* # of edges in list */
X
X byte process[2]; /* Scratch */
X int num_to_move;
X struct block_hdr *move_to;
} Block_hdr;
X
static Block *free_blocks = NULL;
X
void free_block(Block *b)
{
X b->next = free_blocks;
X free_blocks = b;
}
X
Block *new_block()
{
X Block *rv;
X
X if (free_blocks)
X {
X rv = free_blocks;
X free_blocks = free_blocks->next;
X } else
X {
X rv = (Block *)malloc(sizeof(Block));
X assert(rv);
X }
X return(rv);
}
X
static Block_hdr *free_block_hdrs = NULL;
X
void free_block_hdr(Block_hdr *bh)
{
X bh->next = free_block_hdrs;
X free_block_hdrs = bh;
}
X
Block_hdr *new_block_hdr()
{
X Block_hdr *rv;
X
X if (free_block_hdrs)
X {
X rv = free_block_hdrs;
X free_block_hdrs = free_block_hdrs->next;
X } else
X {
X rv = (Block_hdr *)malloc(sizeof(Block_hdr));
X assert(rv);
X }
X
X rv->first = NULL;
X rv->next = NULL;
X rv->process[0] = rv->process[1] = 1;
X rv->move_to = NULL;
X rv->count = rv->num_to_move = 0;
X return(rv);
}
X
#define T_DEG(edge, vf, end) \
X P_DEG((edge).p, (vf), T_VTX(edge, vf, end))
#define T_VTX(edge, vf, end) \
X ((edge).p->vf_num[(edge).e][(vf)][(edge).dir ^ (end)])
#define T_IDX(edge, vf, end) \
X ((edge).p->idx[(edge).e][(vf)][(edge).dir ^ (end)])
#define TAG(edge) ((edge).p->tag[(edge).e][(edge).dir])
X
void add_block(Block *b, Block_hdr *bh)
{
X Block *bf = bh->first;
X
X if (bf == NULL)
X {
X b->last = b->next = b;
X bh->first = b;
X } else
X {
X Block *bn = bf->next;
X
X bn->last = b;
X bf->next = b;
X b->next = bn;
X b->last = bf;
X }
X bh->count++;
X b->list = bh;
}
X
void delete_block(Block *b, Block_hdr *bh)
{
X assert(bh == b->list && --bh->count >= 0);
X if (b->next == b)
X {
X bh->first = NULL;
X } else
X {
X if (bh->first == b)
X bh->first = b->next;
X b->next->last = b->last;
X b->last->next = b->next;
X }
X b->next = b->last = NULL;
X b->list = NULL;
}
X
/* L_R: 0: CCW advance, 1: CW advance */
Edge t_next_edge(Edge edge, int vf, int l_r)
{
X byte vtx = T_VTX(edge, vf, 0);
X int deg = T_DEG(edge, vf, 0);
X int idx = T_IDX(edge, vf, 0);
X Edge rv;
X
X if (l_r)
X {
X idx++;
X if (idx == deg)
X idx = 0;
X } else
X {
X idx--;
X if (idx == -1)
X idx = deg - 1;
X }
X rv.p = edge.p;
X rv.e = P_EDGE(edge.p, vf, vtx, idx);
X rv.dir = !(P_END(edge.p, vf, vtx, idx));
X return(rv);
}
X
Block_hdr *mark_tag(Polyhedron *p)
{
X int j, k, d0, d1, df0, df1;
X int did_something;
X Block_hdr *bh_arr[MAX_DEGREE-2][MAX_DEGREE-2][MAX_DEGREE-2][MAX_DEGREE-2];
X /* 3...MAX_DEGREE */
X Block *b, *b2, *edge_block;
X Block *b_move, *bs_to_move;
X Block_hdr *block_hdrs, *bh, *edge_bh, *new_bh, *bh_test;
X Polyhedron *q;
X Edge edge;
X
X for (d0 = 0; d0 < MAX_DEGREE-2; d0++)
X for (d1 = 0; d1 < MAX_DEGREE-2; d1++)
X for (df0 = 0; df0 < MAX_DEGREE-2; df0++)
X for (df1 = 0; df1 < MAX_DEGREE-2; df1++)
X bh_arr[d0][d1][df0][df1] = NULL;
X
X block_hdrs = NULL;
X
X for (q = p; q != NULL; q = q->next)
X for (j = 0; j < q->n_e; j++)
X for (k = 0; k < 2; k++)
X {
X edge.p = q;
X edge.e = j;
X edge.dir = k;
X d0 = T_DEG(edge, 0, 0);
X d1 = T_DEG(edge, 0, 1);
X df0 = T_DEG(edge, 1, 0);
X df1 = T_DEG(edge, 1, 1);
X if ((bh = bh_arr[d0-3][d1-3][df0-3][df1-3]) == NULL)
X {
X bh = bh_arr[d0-3][d1-3][df0-3][df1-3] = new_block_hdr();
X bh->next = block_hdrs;
X block_hdrs = bh;
X }
X b = new_block();
X b->e = edge;
X TAG(edge) = b;
X add_block(b, bh);
X }
X
X do
X {
X did_something = 0;
X
X for (bh = block_hdrs; bh != NULL; bh = bh->next)
X for (j = 0; j < 2; j++)
X if (bh->process[j])
X {
X did_something = 1;
X bh->process[j] = 0;
X bs_to_move = NULL;
X
X b = bh->first;
X if (bh->first != NULL)
X do
X {
X edge = t_next_edge(b->e, 0, j);
X TAG(edge)->list->num_to_move++;
X b_move = new_block();
X b_move->next = bs_to_move;
X b_move->e = edge;
X bs_to_move = b_move;
X b = b->next;
X } while (b != bh->first);
X
#if 1 /* Debug */
X for (bh_test = block_hdrs; bh_test != NULL; bh_test = bh_test->next)
X assert(bh_test->move_to == NULL && bh_test->num_to_move >= 0 &&
X bh_test->num_to_move <= bh_test->count);
#endif
X
X for (b = bs_to_move; b != NULL; )
X {
X edge = b->e;
X edge_block = TAG(edge);
X edge_bh = edge_block->list;
X if (edge_bh->num_to_move == 0)
X ; /* Changed move all to move none; skip*/
X else if (edge_bh->num_to_move == edge_bh->count)
X edge_bh->num_to_move = 0; /* If to move all, don't move any */
X else
X {
X /* Move movable edges in EDGE_BH into NEW_BH */
X /* May need to create NEW_BH, & mark it as processable */
X if (edge_bh->move_to == NULL)
X {
X edge_bh->move_to = new_bh = new_block_hdr();
X new_bh->next = block_hdrs;
X block_hdrs = new_bh;
X new_bh->process[0] = new_bh->process[1] = 1;
X for (k = 0; k < 2; k++)
X if (!edge_bh->process[k] &&
X edge_bh->count - edge_bh->num_to_move < edge_bh->num_to_move)
X {
X edge_bh->process[k] = 1;
X new_bh ->process[k] = 0;
X }
X } else
X new_bh = edge_bh->move_to;
X delete_block(edge_block, edge_bh);
X add_block(edge_block, new_bh);
X assert(--edge_bh->num_to_move >= 0);
X if (edge_bh->num_to_move == 0)
X edge_bh->move_to = NULL;
X }
X b2 = b->next;
X free_block(b);
X b = b2;
X }
X
#if 1 /* Debug */
X for (bh_test = block_hdrs; bh_test != NULL; bh_test = bh_test->next)
X assert(bh_test->num_to_move == 0 && bh_test->move_to == NULL);
#endif
X
X }
X } while (did_something);
X
X return(block_hdrs);
}
X
/*
X * Pick out the unique polyhedra in the list.
X * Identify polyhedra with the same index #. Indices are from 0 to n-1.
X * Also calculates automorphism groups sizes.
X */
Polyhedron *uniquify_polyhedra(int n, Polyhedron *p)
{
X int minl_idx, i, grp_size;
X byte *keep;
X Block_hdr *bh;
X Block *b;
X Polyhedron *q, *rv, *q2;
X
X assert(keep = (byte *)malloc(n*sizeof(byte)));
X for (i = 0; i < n; i++)
X keep[i] = 0;
X
X for (q = p; q != NULL; q = q->next)
X {
X bh = q->tag[0][0]->list;
X /* Keep only minimal index # */
X b = bh->first;
X assert(b);
X minl_idx = INT_MAX;
X do
X {
X if (b->e.p->index_number < minl_idx)
X {
X minl_idx = b->e.p->index_number;
X grp_size = 1;
X } else if (b->e.p->index_number == minl_idx)
X grp_size++;
X b = b->next;
X } while (b != bh->first);
X assert(minl_idx < INT_MAX);
X keep[minl_idx] = grp_size;
X }
X
X rv = NULL;
X
X for (q = p; q != NULL; q = q2)
X {
X q2 = q->next;
X if (keep[q->index_number] > 0)
X {
X q->next = rv;
X rv = q;
X q->group_size = keep[q->index_number];
X keep[q->index_number] = 0;
X } else
X free_polyhedron(q);
X }
X
X free(keep);
X return(rv);
}
X
void free_tags(Block_hdr *bh)
{
X Block_hdr *bh2;
X Block *b, *b2;
X
X for (; bh != NULL; )
X {
X if (bh->first != NULL)
X {
X b = bh->first;
X do
X {
X b2 = b->next;
X free_block(b);
X b = b2;
X } while (b != bh->first);
X }
X bh2 = bh->next;
X free_block_hdr(bh);
X bh = bh2;
X }
}
X
/* Set self-dual flag in a polyhedron */
void self_dual_mark(Polyhedron *p)
{
X Polyhedron p_dual, p_dual_refl, p_copy;
X Block_hdr *bh0, *bh;
X Block *b;
X
X p->is_self_dual = 0;
X if (p->n_vfs[0] != p->n_vfs[1])
X return;
X
X p_dual_refl = p_dual = p_copy = *p;
X p_dual_refl.next = &p_dual;
X p_dual.next = &p_copy;
X p_copy.next = NULL;
X dualize(&p_dual);
X dualize(&p_dual_refl);
X reflect(&p_dual_refl);
X bh0 = mark_tag(&p_dual_refl);
X bh = p_copy.tag[0][0]->list;
X b = bh->first;
X assert(b);
X do
X {
X if (b->e.p == &p_dual || b->e.p == &p_dual_refl)
X {
X p->is_self_dual = 1;
X break;
X }
X b = b->next;
X } while (b != bh->first);
X
X free_tags(bh0);
}
X
/* Set self-dual flag in a list of polyhedra */
void self_dual_mark_list(Polyhedron *p)
{
X Polyhedron *q;
X
X for (q = p; q != NULL; q = q->next)
X self_dual_mark(q);
}
X
/*
X * Number a list and add reflections; then uniquify it &
X * calculate automorphism group sizes.
X */
void uniquify_list(Polyhedron **p_p)
{
X Polyhedron *p_new, *q, *p = *p_p;
X int m = 0;
X Block_hdr *bh;
X
X if (p == NULL)
X return;
X
X for (q = p; q != NULL; q = q->next)
X q->index_number = m++;
X
X for (q = p; q != NULL; q = q->next)
X {
X p_new = new_polyhedron();
X *p_new = *q;
X reflect(p_new);
X p_new->index_number = q->index_number;
X ADD_LIST(p, p_new);
X }
#if 0
X printf("[Uniquifying %d]\n", 2*m);
#endif
X bh = mark_tag(p);
X p = uniquify_polyhedra(m, p);
X free_tags(bh);
X
X *p_p = p;
}
X
int compare_int(const void *a, const void *b)
{
X if (*((int *)a) < *((int *)b))
X return(-1);
X if (*((int *)a) > *((int *)b))
X return(1);
X return(0);
}
X
typedef struct
{
X Polyhedron *p;
X int h[MAX_EDGES];
} Hash_record;
X
int compare_hash_rec(const void *a, const void *b)
{
X int i;
X
X for (i = 0; i < MAX_EDGES; i++)
X {
X if (((Hash_record *)a)->h[i] < ((Hash_record *)b)->h[i])
X return(-1);
X if (((Hash_record *)a)->h[i] > ((Hash_record *)b)->h[i])
X return(1);
X }
X return(0);
}
X
void uniquify_list_with_hash(Polyhedron **p_p)
{
X Polyhedron *p = *p_p;
X int i, j, i0, n, d00, d01, d10, d11;
X Polyhedron *p_new, *q;
X Hash_record *hashes;
X
X if (p == NULL)
X return;
X
X n = length(p);
X
X hashes = (Hash_record *)malloc(sizeof(Hash_record)*n);
X assert(hashes);
X
X for (q = p, i = 0; i < n; i++, q = q->next)
X {
X hashes[i].p = q;
X for (j = 0; j < q->n_e; j++)
X {
X d00 = P_DEG(q, 0, q->vf_num[j][0][0]);
X d01 = P_DEG(q, 0, q->vf_num[j][0][1]);
X d10 = P_DEG(q, 1, q->vf_num[j][1][0]);
X d11 = P_DEG(q, 1, q->vf_num[j][1][1]);
X hashes[i].h[j] = (d00 + d01) | ((d00 * d01) << 8) |
X ((d10 + d11) << 16) | ((d10 * d11) << 24);
X }
X for (j = q->n_e; j < MAX_EDGES; j++)
X hashes[i].h[j] = 0;
X qsort(hashes[i].h, MAX_EDGES, sizeof(int), compare_int);
X }
X qsort(hashes, n, sizeof(Hash_record), compare_hash_rec);
X
X p = NULL;
X for (i = 0; i < n; i = j)
X {
X j = i + 1;
X while (j < n &&
X compare_hash_rec((void *)&hashes[i], (void *)&hashes[j]) == 0)
X j++;
X for (i0 = i; i0 < j - 1; i0++)
X hashes[i0].p->next = hashes[i0+1].p;
X hashes[j-1].p->next = NULL;
X p_new = hashes[i].p;
X uniquify_list(&p_new);
X assert(p_new);
X for (q = p_new; q->next != NULL; q = q->next)
X ;
X q->next = p;
X p = p_new;
X }
X
X free(hashes);
X *p_p = p;
}
X
Polyhedron wheel(int n)
{
X Polyhedron rv;
X int i;
X
X assert(n >= 3 && n <= MAX_DEGREE);
X
X rv.n_vfs[0] = rv.n_vfs[1] = n + 1;
X rv.n_e = 2*n;
X rv.ptr[0][0] = rv.ptr[1][0] = 0;
X for (i = 1; i <= n + 1; i++)
X rv.ptr[0][i] = rv.ptr[1][i] = n+3*(i-1);
X for (i = 0; i < n; i++)
X {
X rv.e_num[0][i] = i;
X rv.ends [0][i] = 0;
X
X rv.e_num[1][i] = 2*n - 1 - i;
X rv.ends [1][i] = 0;
X
X rv.e_num[0][n+3*i] = n + i;
X rv.ends [0][n+3*i] = 0;
X
X rv.e_num[0][n+3*i+1] = i;
X rv.ends [0][n+3*i+1] = 1;
X
X rv.e_num[0][n+3*i+2] = ((i == 0) ? 2*n - 1 : n + i - 1);
X rv.ends [0][n+3*i+2] = 1;
X
X rv.e_num[1][n+3*i] = ((i == n - 1) ? 0 : i + 1);
X rv.ends [1][n+3*i] = 0;
X
X rv.e_num[1][n+3*i+1] = i;
X rv.ends [1][n+3*i+1] = 1;
X
X rv.e_num[1][n+3*i+2] = n + i;
X rv.ends [1][n+3*i+2] = 1;
X
X rv.vf_num[i][0][0] = 0;
X rv.vf_num[i][0][1] = i + 1;
X rv.vf_num[i][1][0] = ((i == 0) ? n : i);
X rv.vf_num[i][1][1] = i + 1;
X
X rv.idx [i][0][0] = i;
X rv.idx [i][0][1] = 1;
X rv.idx [i][1][0] = 0;
X rv.idx [i][1][1] = 1;
X
X rv.vf_num[i+n][0][0] = i + 1;
X rv.vf_num[i+n][0][1] = ((i == n - 1) ? 1 : i + 2);
X rv.vf_num[i+n][1][0] = 0;
X rv.vf_num[i+n][1][1] = i + 1;
X
X rv.idx [i+n][0][0] = 0;
X rv.idx [i+n][0][1] = 2;
X rv.idx [i+n][1][0] = n - 1 - i;
X rv.idx [i+n][1][1] = 2;
X }
X
X assert(check_polyhedron(&rv));
X
X return(rv);
}
X
int gcd(int a, int b)
{
X int b_new;
X
X if (a < 0) a = -a;
X if (b < 0) b = -b;
X while (b != 0)
X {
X b_new = a % b;
X a = b;
X b = b_new;
X }
X return(a);
}
X
/*
X * Returns primitive (gcd 1) solution to matrix * soln = 0; matrix is m by n,
X * soln is n long. Returns 0 if no nonzero solution. Destroys matrix[].
X */
#define MAX_ROWS 100
int solve(int m, int n, int *matrix, int *soln)
{
X int i, j0, j, k, l, max_k, the_j, tot;
X int cols[MAX_ROWS];
X int gg, mult, m_elem, temp, min_abs;
X
X assert(m <= MAX_ROWS);
X j = 0;
X for (i = 0; i < m; i++)
X {
X for (; j < n; j++)
X {
X min_abs = INT_MAX;
X max_k = -1;
X for (k = i; k < m; k++)
X if (matrix[k*n+j] != 0 && abs(matrix[k*n+j]) < min_abs)
X {
X min_abs = abs(matrix[k*n+j]);
X max_k = k;
X }
X if (max_k >= 0)
X break;
X }
X if (j == n)
X break; /* Everything's 0 */
X cols[i] = j;
X for (j0 = j; j0 < n; j0++)
X {
X temp = matrix[max_k*n+j0];
X matrix[max_k*n+j0] = matrix[i*n+j0];
X matrix[i*n+j0] = temp;
X }
X m_elem = matrix[i*n+j];
X for (k = i+1; k < m; k++)
X {
X mult = matrix[k*n+j];
X gg = 0;
X for (j0 = j+1; j0 < n; j0++)
X {
X matrix[k*n+j0] *= m_elem;
X matrix[k*n+j0] -= mult * matrix[i*n+j0];
X gg = gcd(gg, matrix[k*n+j0]);
X }
X if (gg != 0)
X for (j0 = j+1; j0 < n; j0++)
X matrix[k*n+j0] /= gg;
X }
X j++;
X }
X
X if (i == n)
X return(0); /* {0,...,n-1} = cols[]; no free vars */
X
X j = n-1;
X for (k = i-1; k >= 0; k--)
X {
X if (j > cols[k])
X break;
X if (j == cols[k])
X j--;
X }
X the_j = j;
X assert(the_j >= 0);
X
X for (j0 = 0; j0 < n; j0++)
X soln[j0] = (j0 == the_j); /* Make solution nonzero */
X
X for (k = i-1; k >= 0; k--)
X {
X j = cols[k];
X tot = 0;
X for (l = k+1; l < i; l++)
X tot += matrix[k*n+cols[l]] * soln[cols[l]];
X if (j < the_j)
X tot += matrix[k*n+the_j] * soln[the_j];
X soln[j] = -tot;
X soln[the_j] *= matrix[k*n+j];
X for (l = k+1; l < i; l++)
X soln[cols[l]] *= matrix[k*n+j];
X gg = soln[the_j];
X for (l = k; l < i; l++)
X gg = gcd(gg, soln[cols[l]]);
X soln[the_j] /= gg;
X for (l = k; l < i; l++)
X soln[cols[l]] /= gg;
X }
X return(1);
}
#undef MAX_ROWS
X
int comp_ints(const void *a, const void *b)
{
X if (*((const int *)a) > *((const int *)b))
X return(1);
X if (*((const int *)a) < *((const int *)b))
X return(-1);
X return(0);
}
X
int is_perfect_dissection(const Dissection *d)
{
X int i, the_sqs[MAX_SQUARES];
X
X for (i = 0; i < d->n; i++)
X the_sqs[i] = d->sq[i].sz;
X qsort(the_sqs, d->n, sizeof(int), comp_ints);
X for (i = 0; i < d->n-1; i++)
X if (the_sqs[i] == the_sqs[i+1])
X return(0);
X return(1);
}
X
void flip_x(Dissection *d)
{
X int i;
X
X for (i = 0; i < d->n; i++)
X d->sq[i].x = d->x - d->sq[i].sz - d->sq[i].x;
}
X
void flip_y(Dissection *d)
{
X int i;
X
X for (i = 0; i < d->n; i++)
X d->sq[i].y = d->y - d->sq[i].sz - d->sq[i].y;
}
X
void flip_45(Dissection *d)
{
X int i, temp;
X
X temp = d->x;
X d->x = d->y;
X d->y = temp;
X for (i = 0; i < d->n; i++)
X {
X temp = d->sq[i].x;
X d->sq[i].x = d->sq[i].y;
X d->sq[i].y = temp;
X }
}
X
/* Return 1 if did something, 0 if not */
int reduce_dissection(Dissection *d)
{
X int g = gcd(d->x, d->y);
X int i;
X
X for (i = 0; i < d->n && g != 1; i++)
X g = gcd(g, d->sq[i].sz);
X
X if (g == 1)
X return(0);
X
X for (i = 0; i < d->n; i++)
X {
X d->sq[i].sz /= g;
X d->sq[i].x /= g;
X d->sq[i].y /= g;
X }
X
X d->x /= g;
X d->y /= g;
X return(1);
}
X
void canonicalize_dissection(Dissection *d)
{
X int i, cx, cy, mcx, mcy, max_corner, num_corners, max_adj, the_adj;
X
X /* This should never be necessary */
X assert(!reduce_dissection(d));
X
X /* Squared rectangles should be wider than they are high */
X if (d->y > d->x)
X flip_45(d);
X
X num_corners = 0;
X max_corner = 0;
X mcx = mcy = -1;
X for (i = 0; i < d->n; i++)
X {
X if (d->sq[i].x == 0)
X cx = 0;
X else if (d->sq[i].x + d->sq[i].sz == d->x)
X cx = 1;
X else continue;
X if (d->sq[i].y == 0)
X cy = 0;
X else if (d->sq[i].y + d->sq[i].sz == d->y)
X cy = 1;
X else continue;
X num_corners++;
X if (d->sq[i].sz > max_corner)
X {
X mcx = cx;
X mcy = cy;
X max_corner = d->sq[i].sz;
X }
X }
X assert(num_corners == 4 && max_corner > 0);
X
X /* For a squared rectangle, want biggest square in UL corner */
X if (mcx) flip_x(d);
X if (mcy) flip_y(d);
X if (d->x != d->y)
X return;
X
X /* For a squared square, want square to right of UL corner & at U edge
X * to be bigger than square below UL corner & at L edge */
X max_adj = 0;
X the_adj = -1;
X for (i = 0; i < d->n; i++)
X {
X if (d->sq[i].x == max_corner && d->sq[i].y == 0 && d->sq[i].sz > max_adj)
X {
X the_adj = 0;
X max_adj = d->sq[i].sz;
X } else
X if (d->sq[i].x == 0 && d->sq[i].y == max_corner && d->sq[i].sz > max_adj)
X {
X the_adj = 1;
X max_adj = d->sq[i].sz;
X }
X }
X assert(max_adj > 0);
X if (max_adj)
X flip_45(d);
}
X
int comp_ul_squares(const void *a, const void *b)
{
X if (((const DissectionSquare *)a)->y < ((const DissectionSquare *)b)->y)
X return(-1);
X if (((const DissectionSquare *)a)->y > ((const DissectionSquare *)b)->y)
X return(1);
X if (((const DissectionSquare *)a)->x < ((const DissectionSquare *)b)->x)
X return(-1);
X if (((const DissectionSquare *)a)->x > ((const DissectionSquare *)b)->x)
X return(1);
X return(0);
}
X
/* Print the Bouwkamp code. */
void print_dissection_code(const Dissection *d)
{
X DissectionSquare sqs[MAX_SQUARES];
X int i, j;
X
X printf("Order %d, %d by %d: ", d->n, d->x, d->y);
X for (i = 0; i < d->n; i++)
X sqs[i] = d->sq[i];
X qsort(sqs, d->n, sizeof(DissectionSquare), comp_ul_squares);
X for (i = 0; i < d->n; )
X {
X putchar('(');
X printf("%d", sqs[i].sz);
X j = i+1;
X while (j < d->n && sqs[j].y == sqs[j-1].y
X && sqs[j].x == sqs[j-1].x + sqs[j-1].sz)
X printf(",%d", sqs[j++].sz);
X putchar(')');
X i = j;
X }
X putchar('\n');
}
X
void print_dissection(const Dissection *d)
{
X int i;
X
X printf("Order %d, %d by %d", d->n, d->x, d->y);
X for (i = 0; i < d->n; i++)
X printf("; %d@(%d,%d)", d->sq[i].sz, d->sq[i].x, d->sq[i].y);
X putchar('\n');
}
X
void induced_rectangle(const Polyhedron *p, int e_num, Dissection *p_out)
{
X int a, b, deg, e, e_ind, i, j, j0, k, n, n_e, k_old, e_old;
X int set[MAX_VERTEXFACES], conductances[MAX_VERTEXFACES*(MAX_VERTEXFACES+1)];
X int min_x, tot_flow, capacity, map_to[MAX_EDGES];
X int top_vtx, bot_vtx, potentials[MAX_VERTEXFACES+1];
X int unset, min_pot, top_ind, bot_ind;
X
X if (!p_out)
X return;
X
X n = p->n_vfs[0];
X n_e = p->n_e;
X
X for (j = 0; j < n*(n+1); j++)
X conductances[j] = 0;
X
X for (i = 0; i < p->n_e; i++)
X if (i != e_num)
X {
X j = p->vf_num[i][0][0];
X k = p->vf_num[i][0][1];
X
X conductances[j*(n+1)+k]++;
X conductances[k*(n+1)+j]++;
X
X conductances[j*(n+1)+j]--;
X conductances[k*(n+1)+k]--;
X }
X
X conductances[p->vf_num[e_num][0][0]*(n+1)+n] = 1;
X conductances[p->vf_num[e_num][0][1]*(n+1)+n] = -1;
X assert(solve(n, n+1, conductances, potentials));
X if (potentials[n] > 0)
X {
X top_ind = 0;
X bot_ind = 1;
X capacity = potentials[n];
X } else
X {
X top_ind = 1;
X bot_ind = 0;
X capacity = -potentials[n];
X }
X top_vtx = p->vf_num[e_num][0][top_ind];
X bot_vtx = p->vf_num[e_num][0][bot_ind];
X min_pot = potentials[bot_vtx];
X
#if 1
X /* Check to see that POTENTIALS[] gives soln with total current CAPACITY */
X for (i = 0; i < n; i++)
X {
X tot_flow = 0;
X for (j = 0; j < P_DEG(p, 0, i); j++)
X {
X e = P_EDGE(p, 0, i, j);
X if (e != e_num)
X tot_flow += potentials[p->vf_num[e][0][!P_END(p, 0, i, j)]] -
X potentials[i];
X }
X if (i == top_vtx)
X assert(tot_flow == -capacity);
X else if (i == bot_vtx)
X assert(tot_flow == capacity);
X else
X assert(tot_flow == 0);
X }
#endif
X
X /* Fill in Y coordinates and square sizes of dissection */
X
X j = 0;
X for (i = 0; i < n_e; i++)
X if (i == e_num)
X map_to[i] = -1;
X else
X {
X a = potentials[p->vf_num[i][0][0]];
X b = potentials[p->vf_num[i][0][1]];
X if (a != b)
X {
X map_to[i] = j;
X p_out->sq[j].sz = abs(a-b);
X p_out->sq[j].y = MIN(a, b) - min_pot;
X p_out->sq[j].x = -1;
X j++;
X } else
X map_to[i] = -1;
X }
X p_out->n = j;
X p_out->x = capacity;
X p_out->y = potentials[top_vtx] - min_pot;
X
X /* Fill in X coordinates at top */
X deg = P_DEG(p, 0, top_vtx);
X min_x = 0;
X j0 = j = p->idx[e_num][0][top_ind];
X for (;;)
X {
X j0++;
X if (j0 == deg)
X j0 = 0;
X if (j0 == j)
X break;
X e = P_EDGE(p, 0, top_vtx, j0);
X e_ind = map_to[e];
X if (e_ind >= 0)
X {
X p_out->sq[e_ind].x = min_x;
X min_x += p_out->sq[e_ind].sz;
X }
X }
X assert(min_x == p_out->x);
X
X for (i = 0; i < n; i++)
X set[i] = 0;
X set[top_vtx] = set[bot_vtx] = 1;
X
X do
X {
X unset = 0;
X for (i = 0; i < n; i++)
X if (!set[i])
X {
X deg = P_DEG(p, 0, i);
X e_old = P_EDGE(p, 0, i, 0);
X k_old = p->vf_num[e_old][0][!P_END(p, 0, i, 0)];
X j = 1;
X for (;;)
X {
X e = P_EDGE(p, 0, i, j);
X k = p->vf_num[e][0][!P_END(p, 0, i, j)];
X if (potentials[k] <= potentials[i] &&
X potentials[k_old] > potentials[i])
X {
X assert(map_to[e_old] >= 0);
X min_x = p_out->sq[map_to[e_old]].x;
X break;
X }
X k_old = k;
X e_old = e;
X j++;
X if (j == deg)
X j = 0;
X }
X if (min_x < 0)
X {
X unset = 1;
X continue;
X }
X set[i] = 1;
X while (potentials[k] == potentials[i])
X {
X j++;
X if (j == deg)
X j = 0;
X e = P_EDGE(p, 0, i, j);
X k = p->vf_num[e][0][!P_END(p, 0, i, j)];
X }
X while (potentials[k] < potentials[i])
X {
X assert((e_ind = map_to[e]) >= 0);
X p_out->sq[e_ind].x = min_x;
X min_x += p_out->sq[e_ind].sz;
X j++;
X if (j == deg)
X j = 0;
X e = P_EDGE(p, 0, i, j);
X k = p->vf_num[e][0][!P_END(p, 0, i, j)];
X }
X }
X } while (unset);
}
X
#define MAX_GROUP_SIZE 120
/*
X * Icosahedral group, S_5; bigger C_n's and D_n's exist, but won't show
X * up with our # of edges
X */
X
/* Only bother to generate graphs with # vertices >= # faces */
int main(int argc, char **argv)
{
X Polyhedron *q, *p, *p_new,
X *ps[MAX_EDGES-5][MAX_VERTEXFACES-3][MAX_VERTEXFACES-3];
X int d, e, v, i, j, m, nv, nf, vf, total, grps[2][MAX_GROUP_SIZE];
X Dissection dissection;
X
X for (e = 0; e <= MAX_EDGES-6; e++)
X for (nv = 0; nv <= MAX_VERTEXFACES-4; nv++)
X for (nf = 0; nf <= nv; nf++)
X ps[e][nv][nf] = NULL;
X
X /* Start with 6 edges (W3=the tetrahedron) */
X for (e = 6; e <= MAX_EDGES; e++)
X {
X p = NULL;
X m = 0;
X if (e % 2 == 0)
X {
X p_new = new_polyhedron();
X *p_new = wheel(e/2);
X ADD_LIST(ps[e-6][e/2-3][e/2-3], p_new);
X }
X
X /*
X * Dillencourt, J. Comb. Theory B, 66, 87-122, Thms. 4.1, 4.2;
X * we can generate all polyhedra with |V|>=|F| by vertex-splitting,
X * and with |F|>=|V| by face-splitting
X * (except for the wheel.)
X *
X * 4 vertices means 6 edges, so take nv>=5-4=1; similarly, nf>=1.
X */
X if (e >= 7)
X {
X for (nv = 1; nv <= MAX_VERTEXFACES-4; nv++)
X for (nf = 1; nf <= nv; nf++)
X {
X if (nf < nv)
X vf = 0; /* Decrement # of vertices */
X else
X vf = 1; /* Decrement # of faces */
X
X for (q = ps[e-7][nv-(!vf)][nf-vf]; q != NULL; q = q->next)
X {
X for (v = 0; v < q->n_vfs[vf]; v++)
X {
X d = P_DEG(q, vf, v);
X for (i = 2; i < d; i++)
X for (j = (i == d-1); j < i-1; j++)
X {
X p_new = new_polyhedron();
X *p_new = *q;
X make_new_edge(p_new, vf, v, i, j);
X assert(p_new->n_vfs[0]-4 == nv && p_new->n_vfs[1]-4 == nf);
X ADD_LIST(ps[e-6][nv][nf], p_new);
X }
X }
X }
X }
X }
X
X for (nv = 0; nv <= MAX_VERTEXFACES-4; nv++)
X for (nf = 0; nf <= nv; nf++)
X if (ps[e-6][nv][nf] != NULL)
X {
#ifdef HASH
X uniquify_list_with_hash(&ps[e-6][nv][nf]);
#else
X uniquify_list(&ps[e-6][nv][nf]);
#endif
X self_dual_mark_list(ps[e-6][nv][nf]);
X
X for (i = 0; i < MAX_GROUP_SIZE; i++)
X grps[0][i] = grps[1][i] = 0;
X total = 0;
X
X for (q = ps[e-6][nv][nf]; q != NULL; q = q->next)
X {
X assert(q->group_size >= 1 && q->group_size <= MAX_GROUP_SIZE);
X assert(q->is_self_dual == 0 || q->is_self_dual == 1);
X grps[q->is_self_dual][q->group_size-1]++;
X total++;
X }
X printf("%d polyhedra, %d vertices, %d edges, %d faces\n", total,
X nv+4, e, nf+4);
X
X for (i = 1; i <= MAX_GROUP_SIZE; i++)
X if (grps[0][i-1] != 0 || grps[1][i-1] != 0)
X printf(" Group size %5d: not self-dual %5d, self-dual %5d\n",
X i, grps[0][i-1], grps[1][i-1]);
X
X putchar('\n');
X
X printf("Rectangles:\n");
X
X for (q = ps[e-6][nv][nf]; q != NULL; q = q->next)
X for (i = 0; i < q->n_e; i++)
X {
X induced_rectangle(q, i, &dissection);
X if (is_perfect_dissection(&dissection))
X {
X canonicalize_dissection(&dissection);
X print_dissection_code(&dissection);
X }
X }
X
X putchar('\n');
X }
X }
X return 0;
}
SHAR_EOF
(set 20 04 11 13 18 51 41 'graph.c'; eval "$shar_touch") &&
chmod 0640 'graph.c' ||
$echo 'restore of' 'graph.c' 'failed'
if ( md5sum --help 2>&1 | grep 'sage: md5sum \[' ) >/dev/null 2>&1 \
&& ( md5sum --version 2>&1 | grep -v 'textutils 1.12' ) >/dev/null; then
md5sum -c << SHAR_EOF >/dev/null 2>&1 \
|| $echo 'graph.c:' 'MD5 check failed'
aa12828a36e496dd5ce8025558f38d1c graph.c
SHAR_EOF
else
shar_count="`LC_ALL= LC_CTYPE= LANG= wc -c < 'graph.c'`"
test 37595 -eq "$shar_count" ||
$echo 'graph.c:' 'original size' '37595,' 'current size' "$shar_count!"
fi
fi
rm -fr _sh02480
exit 0