https://github.com/xflr6/graphviz
Tip revision: 3b255ca931e1c5c61c049790632488022f5662c3 authored by Sebastian Bank on 08 April 2022, 20:09:31 UTC
release 0.19.2
release 0.19.2
Tip revision: 3b255ca
rank_same.py
#!/usr/bin/env python3
"""https://stackoverflow.com/questions/25734244/how-do-i-place-nodes-on-the-same-level-in-dot"""
import graphviz
d = graphviz.Digraph(filename='rank_same.gv')
with d.subgraph() as s:
s.attr(rank='same')
s.node('A')
s.node('X')
d.node('C')
with d.subgraph() as s:
s.attr(rank='same')
s.node('B')
s.node('D')
s.node('Y')
d.edges(['AB', 'AC', 'CD', 'XY'])
d.view()