We use the dot language to draw graph (the graph ^^ in the algorithm).
1. Non-direction diagram
In the dot language, for the non-graph, use the name of the graph followed by the keyword graph. For edges such as u-> V, the dot language is expressed as "U-V".
Here's an example:
$ cat UNDIRECTED.GV
graph undirected {
1--2;
3--2;
4--1;
2--5--4;
}
The command to generate the picture is as follows:
Dot-tpng UNDIRECTED.GV > Undirected.png
The resulting picture is as follows:
You can also use the Neato command.
Neato-tpng UNDIRECTED.GV > Undirected.png
You can also use a different format:
Neato-teps UNDIRECTED.GV > Undirected.eps
2 direction diagram
In the dot language, use-> instead of "--". Use the digraph keyword.
Here's an example:
Digraph directed {
a-> b;
A-> c-> d [color=red,penwidth=3.0];
C-> e;
}
The resulting picture is as follows:
When using Graphviz, it is sometimes reported that "Format:" PNG "not recognized" error. can use
Dot-c
Resolve (requires root permission).
Reference:
Http://www.eecs.berkeley.edu/Pubs/TechRpts/2013/EECS-2013-176.pdf