sandmark.util.graph
Class Dot
java.lang.Object
|
+--sandmark.util.graph.Dot
- public class Dot
- extends java.lang.Object
Visualize a graph using the 'dot' tool.
Just do
sandmark.util.Misc.writeToFile("file.dot", graph.toDot());
run dot on the resulting file
dot -Tps file.dot > file.ps
and then view the postscript file
gv file.ps
To try it out you can do
java sandmark.util.graph.Dot | dot -Tps >! x.ps
Graph edges are color coded according to their
dfs order. Tree edges are black, back edges are
red, forward edges are blue, and cross edges are
magenta.
Nested Class Summary |
(package private) static class |
Dot.MyEdge
|
(package private) static class |
Dot.MyNode
|
Method Summary |
(package private) java.lang.String |
edges2Dot()
|
(package private) java.lang.String |
escapeNewlines(java.lang.String S)
|
java.lang.String |
generate()
A typical dot file looks like this:
digraph test123 {
a -> b -> c;
a -> {x y};
b [shape=box];
c [label="hello\nworld",color=blue,fontsize=24,
fontname="Palatino-Italic",font�color=red,style=filled];
a -> z [label="hi", weight=100];
x -> z [label="multi-line\nlabel"];
edge [style=dashed,color=red];
b -> x;
{rank=same; b x}
}
|
static void |
main(java.lang.String[] args)
|
(package private) java.lang.String |
nodes2Dot()
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
graph
Graph graph
Dot
public Dot(Graph graph)
escapeNewlines
java.lang.String escapeNewlines(java.lang.String S)
nodes2Dot
java.lang.String nodes2Dot()
edges2Dot
java.lang.String edges2Dot()
generate
public java.lang.String generate()
- A typical dot file looks like this:
digraph test123 {
a -> b -> c;
a -> {x y};
b [shape=box];
c [label="hello\nworld",color=blue,fontsize=24,
fontname="Palatino-Italic",font�color=red,style=filled];
a -> z [label="hi", weight=100];
x -> z [label="multi-line\nlabel"];
edge [style=dashed,color=red];
b -> x;
{rank=same; b x}
}
main
public static void main(java.lang.String[] args)