graphviz demo¶
在线 graphviz: http://magjac.com/graphviz-visual-editor/
https://www.tonyballantyne.com/graphs.html#orgheadline12
https://candide-guevara.github.io/cs_related/2019/09/10/graphviz-examples.html
https://www.worthe-it.co.za/blog/2017-09-19-quick-introduction-to-graphviz.html
https://people.eecs.berkeley.edu/~jordan/graphical.html
布局¶
.. digraph:: demo_1
a -> {b c d}
b -> {e f g}
.. digraph:: demo_2
rankdir=LR
a -> {b c d}
b -> {e f g}
.. digraph:: demo_3
layout=neato
a -> {b c d}
b -> {e f g}
.. digraph:: demo_4
layout=neato
edge [len=0.8] # change edge length
overlap=false # prevents nodes from overlapping each other
# These options MIGHT work on other implementations
#overlap_scaling=0.5
#overlap_shrink=true
a -> {b c d}
b -> {e f g}
.. digraph:: demo_5
# A couple of option to expand/compress differently on x and y dimensions.
layout=neato
overlap=false # you NEED THIS for `sep` to take effect
sep="+30,-5" # expands 30 pixels on the x direction, but shrink y by 5
a -> {b c d}
b -> {e f g}
.. digraph:: demo_9
newrank=true
subgraph cluster_cl {
a -> {b c}
}
r -> a
b -> d
# You can quickly get in WTF?! territory ...
# You would expect that rank_d <= rank_r, but nope ...
{rank=min d}
.. digraph:: demo_10
a -> {b c}
# Heavy weight => short, straight and more vertical the edge.
a -> d [weight=3]