#$Id: README.TXT,v 1.4 2007/01/23 16:57:02 mcv21 Exp $

Introduction
============

This README is part of the library of graph analysis and disease
simulation functions submitted along with the thesis "Spacial Spread
of Farm Animal Diseases" for the degree of Doctor of Philosophy at the
University of Cambridge. 

Copyright
=========

The library is Copyright (C) 2007 Matthew Vernon <matthew@debian.org>

This library is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published
by the Free Software Foundation; either version 2 of the License,
or (at your option) any later version.

This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program (as gpl.txt); if not, write to the Free
Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
02110-1301 USA

The contents of the CD
======================

The CD contains this file, a copy of the GNU General Public License
(gpl.txt), the thesis chapter that documents this library
(documentation.pdf), and the subdirectory lib/, which contains the
library itself.

Building and using the library
==============================

To compile the library, change directory into lib/ and type:
make
That should work on most systems with GCC installed, except Microsoft
Windows (which is not currently supported).

Linking files against the library is a platform- and
compiler-dependant operation. As examples, the following invocation
should work on Mac OS X:
gcc -c -o foo.o foo.c
gcc foo.o libgsalgs.dylib.0.1 -lm -o foo
And the following on linux or solaris:
gcc -c -o foo.o foo.c
gcc foo.o libgsalgs.so.0.1 -lm -o foo

If you choose not to install the headers and libraries system-wide,
you will also need to set LD_LIBRARY_PATH or DYLD_LIBRARY_PATH to tell
the linker where to find the library. You system administrator will be
able to advise on this matter.

Chapter 4 of the thesis discusses the library interface in some detail
(and is on this CD as documentation.pdf), but a minimal example
program may prove enlightening. The following program generates a
poisson graph with 6000 nodes and 18000 edges, then simulates a
disease process upon that network (starting with one node infected,
and with a transmission risk of 0.2, and nodes remaining infected for
5 time-periods):

#include <stdio.h>
#include <stdlib.h>
#include <time.h>

#include "gsalgs.h"

int main(void)
{
  struct gennet *g;
  srand48(time(NULL));

  g=poisson_gen(6000,18000,0,G_ADJL);
  sir_net(g,6000,1,0.2,5,10000,stdout);

  g->vtable->free(g);
  
  return(0);
}
