tree in treelib

Solutions on MaxInterview for tree in treelib by the best coders in the world

showing results for - "tree in treelib"
Orson
05 Mar 2018
1>>> from treelib import Node, Tree
2>>> tree = Tree()
3>>> tree.create_node("Harry", "harry")  # root node
4>>> tree.create_node("Jane", "jane", parent="harry")
5>>> tree.create_node("Bill", "bill", parent="harry")
6>>> tree.create_node("Diane", "diane", parent="jane")
7>>> tree.create_node("Mary", "mary", parent="diane")
8>>> tree.create_node("Mark", "mark", parent="jane")
9>>> tree.show()
10Harry
11├── Bill
12└── Jane
13    ├── Diane
14    │   └── Mary
15    └── Mark
16