The following files contained

***********************************************

graphgen.cpp

usage: graphgen num_edges num_nodes

This is a simple program that generates all planar graphs with a given
number of nodes and edges that are simple, have at least 3 edges on each node,
and is at least 2-connected.  This was the first routine I wrote when investigating
perfect squares, and was done before i was aware of "plantri".  However this
is much simpler than plantri and should be easier to understand and modify
if someone were so inclined.  I later modified it to use the same output
format as plantri.  However if most cases it is much slower.  Exception is
if num_edges < 2*num_nodes + 3, then this runs faster than plantri.

***********************************************

all_graphs2

Usage:  all_graphs2  num_edges

Simple script that prints all 2-connected graphs with number of edges less than or equal num_edges.

***********************************************

all_graphs3

Usage:  all_graphs3  num_edges

Simple script that prints all 3-connected graphs with number of edges less than or equal num_edges.

***********************************************

create_3library.cpp

Usage:  No arguments
        stdin is the output from all_graphs2 or graph list of similar format.
        stdout is a library of 3 terminal (plus ground) networks.

A couple sample output lines of this program are the following
    8 3 M 8,5,21,4,8,24,11   10882518 14743615  7 eb,af,f,g,agf,begc,dfe
    10 3 F 46,35,70,20,40,88,57   11374383 12885426  8 eb,ac,bf,fg,agh,chd,dhe,egf

Format is the following:
    <total_edges>  <num_terminals>  <sex>  <resistance_matrix>  <rmin> <rmax>  <num_nodes>  <graph_description>

<sex> is defined as follows
    M - each of the terminals has at least one edge connecting
        No two terminals have an edge connecting them

    F - each of the terminals has at least two edges connecting
        Terminals may have connections between them.

The network defining a square is created from the connection of two of these three terminal networks.

                    |
                    |
             ----------------
             |      G       |
             |              |
             | T1  T2  T3   |
             ----------------
               |    |   |
               |    |   |
             ----------------
             | T3  T2  T1   |
             |              |
             |      G       |
             ----------------
                    |
                    |


The connections in the middle do not represent edges, but rather indicate that the terminal nodes
are directly connected so they become a single node in the resulting combined graph.

If we connection one M and one F network, we are assured that each connecting node has at least 3 edges,
and that there are no parallel edges between terminals.

<resistance_matrix>  The resistance of one of these three terminal networks is defined by a 3X3 matrix.
However the matrix is symetric and all the elements are rational.  Since it is symetric there are 6 unique
values, and since it is rational, each of these six elements can be expressed as a fraction with a common
denominator.  Therefore we print 7 numbers to describe the resistance matrix, a numberator for each unique
element and a common denominator.

<rmin>  This is the resistance of the network when all 3 terminals are shorted together.  It is expressed
as an integer and should be scaled by 2^-24 to get that actual value.
   
<rmax>  This is the resistance of the network when equal current is forced through each of
the 3 terminals, and is the ratio of the average voltage to the total current.

When two networks are connected together as shown above, the combined resistence is always greater than
the sum of the rmins and less than the sum of the rmaxes.  A total resistance of 1 is a necessary condition
for the combined network representing a perfect square.


***********************************************

decompose_file.scr

Usage:  standard input - the output from create_3library

Created files:  creates a file for each sex and order with all the 3-terminal networks sorted in order of rmax


Simple script to decompose the library into a number of files, each sorted and compressed.

***********************************************

search.cpp

Usage:  search  <buffer_size>

stdin:  this is the output from create_3library, preferrably sorted on rmax

stdout:  Output is any perfect squares that are found.

The first "buffer_size" lines of input are stored in an internal buffer, and then subsequent lines
are each tested against all lines in the buffer to see if the combination of the two networks
represented by the two lines form a perfect square.  Generally the first set of lines (buffered) should
be one sex, and the subsequent set of lines of the other sex.

The internal buffer is sorted for rmin.  If the input is presorted for rmax, then often the buffer will 
contain a list which is about the same for rmax and sorted for rmin.  Therefore we can check each subsequent
input line and if its rmax plus the largest rmax of the buffer is less than one we can immediately skip
that input line.  Otherwise we do a binary search to find the point at which the sum of the rmins is greater
than one.  This is the limit of the comparison loop.

The buffer_size should be large enough that the compute time is dominated by the inner loop.  I think 10000 
works fine.


***********************************************

drive_search.scr

Usage:  drive_search.scr <sequence_num>

This is a script to drive the search program.  It assumes the library files have been created and 
deomposed according to the above scripts.  It is called sequantially with different sequence numbers

    driver_search.scr 0
    driver_search.scr 1
    driver_search.scr 2
    driver_search.scr 3
    driver_search.scr 4
    driver_search.scr 5
    driver_search.scr 6

    # etc.

Each such call searches a non-overlapping subset of the entire search space.  This allows the work to be
parallelized.  It also allows restarting after a failure without needing to re-do a huge amount of work.


***********************************************

Example

you should be able to do the following if the programs are compiled correctly and "plantri" is available.
This should give a quick test.


all_graphs2 18 | create_3library | decompose_file.scr
drive_search.scr 0
drive_search.scr 1
drive_search.scr 2
drive_search.scr 3
drive_search.scr 4

