|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
Implementations of this interface can be used for pretty-printing graphs.
| Method Summary | |
String |
edge(Object edge)
Returns a short textual label describing the edge. |
String |
graphAttributes(Graph graph)
Returns graph attributes. |
String |
nodeAttributes(Object node)
Returns [bracketed] node attributes. |
String |
nodeName(Object node)
Returns a textual representation of the node, preferably a short one that can be used in the following plain-text representation of the tree. |
| Method Detail |
public String graphAttributes(Graph graph)
For example, if you choose to pretty-print your graph in the DOT language, then the graph attributes section may look like so:
digraph mygraph {
// the following two lines are graph attributes
node[shape=box,fontsize=8,fontname=verdana,height=0.2,width=0.2,style=filled];
ranksep=0.05;
// the following lines are nodes and edges
A -> B -> C -> D;
B -> E -> F;
C -> G;
D -> I;
D -> J -> H;
}
public String nodeName(Object node)
digraph tree {
A -> B -> C -> D;
B -> E -> F;
C -> G;
D -> I;
D -> J -> H;
}
Example implementation:
public String formatNode(Object node) {
return node == null ? null : ((ObjectType) node).getName();
}
public String nodeAttributes(Object node)
digraph g {
C[label="The C Language"];
J;
C -> J;
}
public String edge(Object edge)
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||