Graphs
You can include graphs anywhere in your wiki pages. Graphs are implemented via the Graphviz library. To include a Graphviz graph in your page, use the following syntax:
Syntax
The general syntax for including graphs is:
%%<graphviz>%%graphviz graph definition%%</graphviz>%%
The syntax for the actual graph definition is the Graphviz syntax. Please see the Graphviz website for details.
Layout
Use the layout attribute to specify the graphviz layout:
%%<graphviz%% layout%%>...</graphviz>%%
The layout attribute can take one of the following values: dot
, neato
, twopi
, circo
or fdp
.
If not specified, the dot
layout will be used.
Alignment
You can specify the graph's alignment on the page by adding one of the following keywords: left
, center
(default), right
. The graph will be aligned accordingly on the page.
Size
You can specify the width or height only with the width
and height
attributes:
%%<graphviz%% width:w%%>...</graphviz>%%
%%<graphviz%% height:h%%>...</graphviz>%%
The width
and height
attribute values are CSS-compatible dimensions, such as: 250px
, 100%
, 20rem
, etc.
The following alternative syntax is also supported:
%%<graphviz%% wxh%%>...</graphviz>%%
where w
and h
are respectively the width and height of the graph in pixels.
You can combine all attributes, but if the height
or width
attributes are also used, they will take precedence over the wxh
attribute.
Caption
Add a caption to your graph with the following syntax:
%%<graphviz%% |caption%%>...</graphviz>%%
Examples
dot layout
graph {
a -- b;
b -- c;
a -- c;
d -- c;
e -- c;
e -- a;
}
</graphviz>
digraph {
rankdir=LR;
size="12,5"
node [shape = doublecircle]; LR_0 LR_3 LR_4 LR_8 LR_10;
node [shape = circle];
LR_0 -> LR_10 [ label = "Sa(B)" ];
LR_0 -> LR_1 [ label = "Testen" ];
LR_1 -> LR_3 [ label = "S($end)" ];
LR_2 -> LR_6 [ label = "SS(b)" ];
LR_2 -> LR_5 [ label = "SS(a)" ];
LR_2 -> LR_4 [ label = "Sx(A)" ];
LR_5 -> LR_7 [ label = "S(b)" ];
LR_5 -> LR_5 [ label = "S(a)" ];
LR_6 -> LR_6 [ label = "S(b)" ];
LR_6 -> LR_5 [ label = "S(a)" ];
LR_7 -> LR_8 [ label = "S(b)" ];
LR_7 -> LR_5 [ label = "S(a)" ];
LR_8 -> LR_6 [ label = "S(b)" ];
LR_8 -> LR_5 [ label = "S(a)" ];
LR_8 -> LR_9 [ label = "Test" ];
}
</graphviz>
neato layout
digraph {
a -> b;
b -> c;
c -> d;
d -> a;
}
</graphviz>
twopi layout
digraph {
a -> b[label="0.2",weight="0.2"];
a -> c[label="0.4",weight="0.4"];
e -> e[label="0.1",weight="0.1"];
e -> b[label="0.7",weight="0.7"];
}
</graphviz>
digraph {
node [shape = circle,
style = filled,
color = grey,
label = '']
node [fillcolor = red]
a
node [fillcolor = green]
b c d
node [fillcolor = orange]
edge [color = grey]
a -> {b c d}
b -> {e f g h i j}
c -> {k l m n o p}
d -> {q r s t u v}
}
</graphviz>
circo layout
graph {
a -- b[color=red,penwidth=3.0];
b -- c;
c -- d[color=red,penwidth=3.0];
d -- e;
e -- f;
a -- d;
b -- d[color=red,penwidth=3.0];
c -- f[color=red,penwidth=3.0];
}
</graphviz>
Subgraphs
digraph {
subgraph cluster_0 {
label="Subgraph A";
a -> b;
b -> c;
c -> d;
}
subgraph cluster_1 {
label="Subgraph B";
a -> f;
f -> c;
}
}
</graphviz>