axiom-developer
[Top][All Lists]

## [Axiom-developer] [GraphViz] (new)

 From: Bill Page Subject: [Axiom-developer] [GraphViz] (new) Date: Tue, 15 Mar 2005 13:43:15 -0600

Changes http://page.axiom-developer.org/zope/mathaction/GraphViz/diff
--
"An Introduction to GraphViz":http://www.linuxjournal.com/article/7275

By Mihalis Tsoukalos on Wed, 2004-09-08 23:00.

How to use command-line tools and basic GraphViz utilities to
produce graphs both simple and complex.

GraphViz is a collection of tools for manipulating graph structures
and generating graph layouts. Graphs can be either directed or
undirected. GraphViz offers both graphical and command-line tools.
A Perl interface also is available, but it is not covered here for
reasons of generality. Graphical tools are not going to be discussed
from the command line.

See more here: http://www.wickle.com/wikis/index.php/Graphviz_extension
<hr />

The follow graphs are generated by MathAction

My First Graph::

\\begin{latex}
\\digraph[scale=0.5]{MyGraph1}{rankdir=LR; a->b; b->c}
\\end{latex}

Produces:
\begin{latex}
\digraph[scale=0.5]{MyGraph1}{rankdir=LR; a->b; b->c}
\end{latex}

A More Complex Example::

\\begin{latex}
\\digraph[scale=1.0]{MyGraph2}{
size ="4,4";
main [shape=box]; /* this is a comment */
main -> parse [weight=8];
parse -> execute;
main -> init [style=dotted];
main -> cleanup;
execute -> { make_string; printf}
init -> make_string;
edge [color=red]; // so is this
main -> printf [style=bold,label="100 times"];
make_string [label="make a string"];
node [shape=box,style=filled,color=".7 .3 1.0"];
execute -> compare;
}
\\end{latex}

Produces:
\begin{latex}
\digraph[scale=1.0]{MyGraph2}{
size ="4,4";
main [shape=box]; /* this is a comment */
main -> parse [weight=8];
parse -> execute;
main -> init [style=dotted];
main -> cleanup;
execute -> { make_string; printf}
init -> make_string;
edge [color=red]; // so is this
main -> printf [style=bold,label="100 times"];
make_string [label="make a string"];
node [shape=box,style=filled,color=".7 .3 1.0"];
execute -> compare;
}
\end{latex}

Here's One From

http://www.linuxjournal.com/article/7275

This::

\\begin{latex}
\\digraph{MyGraph3}
{
node [shape = record];
node0 [ label ="<f0> | <f1> J | <f2> "];
node1 [ label ="<f0> | <f1> E | <f2> "];
node4 [ label ="<f0> | <f1> C | <f2> "];
node6 [ label ="<f0> | <f1> I | <f2> "];
node2 [ label ="<f0> | <f1> U | <f2> "];
node5 [ label ="<f0> | <f1> N | <f2> "];
node9 [ label ="<f0> | <f1> Y | <f2> "];
node8 [ label ="<f0> | <f1> W | <f2> "];
node10 [ label ="<f0> | <f1> Z | <f2> "];
node7 [ label ="<f0> | <f1> A | <f2> "];
node3 [ label ="<f0> | <f1> G | <f2> "];
"node0":f0 -> "node1":f1;
"node0":f2 -> "node2":f1;
"node1":f0 -> "node4":f1;
"node1":f2 -> "node6":f1;
"node4":f0 -> "node7":f1;
"node4":f2 -> "node3":f1;
"node2":f0 -> "node5":f1;
"node2":f2 -> "node9":f1;
"node9":f0 -> "node8":f1;
"node9":f2 -> "node10":f1;
}
\\end{latex}

Gets you this:
\begin{latex}
\digraph{MyGraph3}
{
node [shape = record];
node0 [ label ="<f0> | <f1> J | <f2> "];
node1 [ label ="<f0> | <f1> E | <f2> "];
node4 [ label ="<f0> | <f1> C | <f2> "];
node6 [ label ="<f0> | <f1> I | <f2> "];
node2 [ label ="<f0> | <f1> U | <f2> "];
node5 [ label ="<f0> | <f1> N | <f2> "];
node9 [ label ="<f0> | <f1> Y | <f2> "];
node8 [ label ="<f0> | <f1> W | <f2> "];
node10 [ label ="<f0> | <f1> Z | <f2> "];
node7 [ label ="<f0> | <f1> A | <f2> "];
node3 [ label ="<f0> | <f1> G | <f2> "];
"node0":f0 -> "node1":f1;
"node0":f2 -> "node2":f1;
"node1":f0 -> "node4":f1;
"node1":f2 -> "node6":f1;
"node4":f0 -> "node7":f1;
"node4":f2 -> "node3":f1;
"node2":f0 -> "node5":f1;
"node2":f2 -> "node9":f1;
"node9":f0 -> "node8":f1;
"node9":f2 -> "node10":f1;
}
\end{latex}
--