(Reference) Any Python Tree Data http://anytree.readthedocs.io/en/latest/index.html#any-python-tree-data (Reference) Python Tree Data Release 2.1.4 c0fec0de May 12, 2017 https://media.readthedocs.org/pdf/anytree/latest/anytree.pdf#page=18
from anytree import *
udo = Node("Udo")
marc = Node("Marc", parent=udo)
lian = Node("Lian", parent=marc)
dan = Node("Dan", parent=udo)
jet = Node("Jet", parent=dan)
jan = Node("Jan", parent=dan)
joe = Node("Joe", parent=dan)
print(RenderTree(udo, style=AsciiStyle()).by_attr())
print('-------------------------------------------------')
from anytree.dotexport import RenderTreeGraph
RenderTreeGraph(udo).to_dotfile("tree.dot")
from subprocess import check_call
check_call(['dot','-Tpng','tree.dot','-o','OutputFile.png'])
Recommended Posts