An Axiom Graph Theory Implementation

Graphs, in addition to being interesting structures in their own right, have importance in representing data structures, finite automata, communication networks and so on.

This is mostly an implementation of directed graphs (undirected graphs can be implemented by having arrows in both directions or by using Undirected Graph).

A graph has two parts:

Installation

To install this code goto github (https://github.com/martinbaker/multivector/blob/master/graph.spad) and download the file:

graph.spad

Then compile them:

(1) -> )boot $bootStrapMode := true
(1) -> )co graph.spad
(1) -> )boot $bootStrapMode := false
(1) -> )co graph.spad

As you can see above it is compiled twice, once in 'boot strap mode' and again without. This is because of circular definitions in the code.

Tutorial

If Graph and directedGraph are not already loaded then load them as follows:

(1) -> )library LOOP
   Loop is now explicitly exposed in frame frame1
   Loop will be automatically loaded when needed from
      /home/martin/LOOP.NRLIB/LOOP
(1) -> )library FGRPH
   Graph is now explicitly exposed in frame frame1
   Graph will be automatically loaded when needed from
      /home/martin/FGRPH.NRLIB/GRPH
(1) -> )library FGRPH-
   Graph& is now explicitly exposed in frame frame1
   Graph& will be automatically loaded when needed from
      /home/martin/FGRPH-.NRLIB/GRPH-
(1) -> )library DGRPH
   DirectedGraph is now explicitly exposed in frame frame1
   DirectedGraph will be automatically loaded when needed from
      /home/martin/DGRPH.NRLIB/DGRPH
(1) -> )library FNGRPH
   FunctionGraph is now explicitly exposed in frame frame1
   FunctionGraph will be automatically loaded when needed from
      /home/martin/FGRPH.NRLIB/FGRPH
(1) -> )library UDGRPH
   UndirectedGraph is now explicitly exposed in frame frame1
   UndirectedGraph will be automatically loaded when needed from
      /home/martin/UDGRPH.NRLIB/UDGRPH
(1) -> )library MFGRPH
   MultifunctionGraph is now explicitly exposed in frame frame1
   MultifunctionGraph will be automatically loaded when needed from
      /home/martin/MFGRPH.NRLIB/MFGRPH
(1) -> )library WGRPH
   WeightedGraph is now explicitly exposed in frame frame1
   WeightedGraph will be automatically loaded when needed from
      /home/martin/WGRPH.NRLIB/WGRPH

This graph framework has many methods to create graph instances, click on the following links for details:

We now have a graph and we can check out various things about it by calling functions such as those listed below. Click on these function names for more information:

Now lets explore the methods for combining the graphs, these include:

There is a much more detailed tutorial for these operations here.

Maps:

Loops and Routes:

Specialised variants of graph:

To follow the whole tutorial start on this page with constructing graphs.


metadata block
see also:
Correspondence about this page

Book Shop - Further reading.

Where I can, I have put links to Amazon for books that are relevant to the subject, click on the appropriate country flag to get more details of the book or to buy it from them.

flag flag flag flag flag flag Axiom Volume 1: Tutorial. Documentation is freely availible from: http://www.axiom-developer.org/axiom-website/documentation.html

 

This site may have errors. Don't use for critical systems.

Copyright (c) 1998-2017 Martin John Baker - All rights reserved - privacy policy.