Graph (colored and no duplicate edges)
strict graph {
a[color=red];f[style=filled];
a -- c
d -- b
b -- a [color=blue]
a -- d
d -- c
d -- a
}
a[color=red];f[style=filled];
a -- c
d -- b
b -- a [color=blue]
a -- d
d -- c
d -- a
}
simple graph
simple digraph
weighted graph
graph {
a -- b[label="0.2",weight="0.2"];
a -- c[label="0.4",weight="0.4"];
c -- b[label="0.6",weight="0.6"];
c -- e[label="0.6",weight="0.6"];
e -- b[label="0.7",weight="0.7"];
}
weighted digraph
digraph {
a -> b[label="0.2",weight="0.2"];
a -> c[label="0.4",weight="0.4"];
c -> b[label="0.6",weight="0.6"];
c -> e[label="0.6",weight="0.6"];
e -> e[label="0.1",weight="0.1"];
e -> b[label="0.7",weight="0.7"];
}
highlight a path
subgraph
digraph G {
subgraph cluster_0 {
style=filled;
color=lightgrey;
node [style=filled,color=white];
a0 -> a1 -> a2 -> a3;
label = "process #1";
}
subgraph cluster_1 {
node [style=filled];
b0 -> b1 -> b2 -> b3;
label = "process #2";
color=blue
}
start -> a0;
start -> b0;
a1 -> b3;
b2 -> a3;
a3 -> a0;
a3 -> end;
b3 -> end;
start [shape=Mdiamond];
end [shape=Msquare];
}
subgraph cluster_0 {
style=filled;
color=lightgrey;
node [style=filled,color=white];
a0 -> a1 -> a2 -> a3;
label = "process #1";
}
subgraph cluster_1 {
node [style=filled];
b0 -> b1 -> b2 -> b3;
label = "process #2";
color=blue
}
start -> a0;
start -> b0;
a1 -> b3;
b2 -> a3;
a3 -> a0;
a3 -> end;
b3 -> end;
start [shape=Mdiamond];
end [shape=Msquare];
}
simple subgraph
digraph {
subgraph cluster_0 {
label="Subgraph A";
a -> b;
b -> c;
c -> d;
}
subgraph cluster_1 {
label="Subgraph B";
a -> f;
f -> c;
}
}
graph -- adjacency-list data structure
graph {
rankdir=LR; // Left to Right, instead of Top to Bottom
a -- { b c d };
b -- { c e };
c -- { e f };
d -- { f g };
e -- h;
f -- { h i j g };
g -- k;
h -- { o l };
i -- { l m j };
t -- z;
}
digraph -- adjacency list data structure
digraph {
a -> {b, c};
b -> {c, a};
d -> a;
}
a -> {b, c};
b -> {c, a};
d -> a;
}
symbol graph
strict graph{
"Tin Men" -- {"DeBoy", "BlumenFeld"};
"Kevin" -- {"Animal House", "The Woodsman"};
"Animal House" -- {"Kevin", "Donald"};
"Donald" -- {"The Eagle Has landed","Cold Mountain"};
}
"Tin Men" -- {"DeBoy", "BlumenFeld"};
"Kevin" -- {"Animal House", "The Woodsman"};
"Animal House" -- {"Kevin", "Donald"};
"Donald" -- {"The Eagle Has landed","Cold Mountain"};
}
Highlight a directed cycle
digraph {
a -> b -> d -> c -> a[color=red,penwidth=3.0];
b -> c;
d -> e;
e -> f;
a -> d;
}
a -> b -> d -> c -> a[color=red,penwidth=3.0];
b -> c;
d -> e;
e -> f;
a -> d;
}