FriCAS currently has a subsystem forgraphs. The discussion below is morstly of historical interest. Note that some names in code below are the same as names in current implementation which causes conflicts and weird error messages... We want an implementation of the mathematical concept of graphgraph* in the sense of Graph Theory See also: Graph_(mathematics) The concept of a graph is fundamental in many areas of mathematics and is the starting point for category theory. Graphs are also very important data structures in many algorithms in computer science. Our goal here therefore is to develop the concept of graph in FriCAS in the most general way possible. Axiom Version fricas )version Spad VersionSee SandBox Category of Graphs in SPAD Aldor Verison First we define the general category of graphs. Note that
we use a [lowercase] short name aldor #include "axiom.as" define GraphCategory(nodes:Type, aldor Compiling FriCAS source code from file /var/lib/zope2.10/instance/axiom-wiki/var/LatexWiki/graphcat.as using Aldor compiler and options -O -Fasy -Fao -Flsp -lfricas -Mno-ALDOR_W_WillObsolete -DFriCAS -Y $FRICAS/algebra -I $FRICAS/algebra Use the system command )set compiler args to change these options. The )library system command was not called after compilation. Now we define finite graphs as follows: aldor #include "axiom.as"; #library graphcat "graphcat.ao"; import from graphcat; inline from graphcat; edges ==> Record(source:nodes, aldor Compiling FriCAS source code from file /var/lib/zope2.10/instance/axiom-wiki/var/LatexWiki/fgraph.as using Aldor compiler and options -O -Fasy -Fao -Flsp -lfricas -Mno-ALDOR_W_WillObsolete -DFriCAS -Y $FRICAS/algebra -I $FRICAS/algebra Use the system command )set compiler args to change these options. The )library system command was not called after compilation. Make sure that FiniteGraph? and GraphCategory? are known to FriCAS: \begin{axiom} )lisp (si::allocate-contiguous-pages 3000 t) )library graphcat fgraph \end{axiom} If we use UPPERCASE in the name of the Aldor library the example below results in: >> System error: AxiomXL file "GRAPHCAT" is missing! But if we use lowercase, it (sometimes) works! However quite often when we refresh this page even without editing it, we get now the error: >> System error: Contiguous blocks exhausted. Currently, 1354 pages are allocated. Use ALLOCATE-CONTIGUOUS-PAGES to expand the space. Example 1: create a simple finite graph: fricas g:FiniteGraph(INT) Why do I need to specify fricas source(e)$FiniteGraph(INT) But without the category definition this seems to be ok? aldor #include "axiom.as" aldor Compiling FriCAS source code from file /var/lib/zope2.10/instance/axiom-wiki/var/LatexWiki/8126689142996008028-25px006.as using Aldor compiler and options -O -Fasy -Fao -Flsp -lfricas -Mno-ALDOR_W_WillObsolete -DFriCAS -Y $FRICAS/algebra -I $FRICAS/algebra Use the system command )set compiler args to change these options. The )library system command was not called after compilation. Example 2: create a simple finite graph: fricas g:FiniteGraph(INT) fricas )lisp (room) Here is another Aldor version SandBox Category of Graphs 2 |