# Test 2-level tree
constants = {0 : {(0 ,): 0.8 , (1 ,): 0.1 }, # c0
1 : {(0 ,): 0.7 , (1 ,): 0.2 }, # c1
2 : {(0 ,): 1.0 }} # c2
tree = Tree(constants)
root = tree.add(name= 'c0' , circuit_id= 0 , node_type= Variable, count= 100 )
root0 = tree.add(name= (0 ,), node_type= Constant, parent= root, count= 70 )
root1 = tree.add(name= (1 ,), node_type= Constant, parent= root, count= 30 )
d1 = tree.add(name= 'δ' , parent= root, node_type= Delta)
c1_0 = tree.add(name= 'c1' , circuit_id= 1 , node_type= Variable, count= 50 , parent= root0)
c1_1 = tree.add(name= 'c1' , circuit_id= 1 , node_type= Variable, count= 20 , parent= root1)
c2_0 = tree.add(name= 'c2' , circuit_id= 2 , node_type= Variable, count= 20 , parent= root0)
c2_1 = tree.add(name= 'c2' , circuit_id= 2 , node_type= Variable, count= 10 , parent= root1)
c1_0_0 = tree.add(name= (0 ,), node_type= Constant, parent= c1_0, count= 40 )
c1_0_1 = tree.add(name= (1 ,), node_type= Constant, parent= c1_0, count= 10 )
d2 = tree.add(name= 'δ' , node_type= Delta, parent= c1_0)
c1_1_0 = tree.add(name= (0 ,), node_type= Constant, parent= c1_1, count= 15 )
c1_1_1 = tree.add(name= (1 ,), node_type= Constant, parent= c1_1, count= 5 )
d3 = tree.add(name= 'δ' , node_type= Delta, parent= c1_1)
c2_0_0 = tree.add(name= (0 ,), node_type= Constant, parent= c2_0, count= 20 )
d4 = tree.add(name= 'δ' , node_type= Delta, parent= c2_0)
c2_1_0 = tree.add(name= (0 ,), node_type= Constant, parent= c2_1, count= 10 )
d5 = tree.add(name= 'δ' , node_type= Delta, parent= c2_1)
none_c1_0_0 = tree.add(name= 'None' , node_type= Variable, parent= c1_0_0, count= 40 )
none_c1_0_0.invariant = True
none_c1_0_1 = tree.add(name= 'None' , node_type= Variable, parent= c1_0_1, count= 5 )
fail_c1_0_1 = tree.add(name= 'fail' , node_type= Variable, parent= c1_0_1, count= 5 )
none_c1_1_0 = tree.add(name= 'None' , node_type= Variable, parent= c1_1_0, count= 15 )
none_c1_1_1 = tree.add(name= 'None' , node_type= Variable, parent= c1_1_1, count= 3 )
fail_c1_1_1 = tree.add(name= 'fail' , node_type= Variable, parent= c1_1_1, count= 2 )
none_c2_0_0 = tree.add(name= 'None' , node_type= Variable, parent= c2_0_0, count= 20 )
none_c2_0_0.invariant = True
fail_c2_1_0 = tree.add(name= 'fail' , node_type= Variable, parent= c2_1_0, count= 10 )
tree.marked = set ([fail_c1_0_1, fail_c1_1_1, fail_c2_1_0])
print (tree)
c0 (100, 0.00e+00)
├── (0,) (70)
│ ├── c1 (50, 2.88e-03)
│ │ ├── (0,) (40)
│ │ │ └── None (40, 0.00e+00)
│ │ ├── (1,) (10)
│ │ │ ├── None (5, 2.27e-02)
│ │ │ └── fail (5, 2.27e-02)
│ │ └── δ
│ └── c2 (20, 2.88e-03)
│ ├── (0,) (20)
│ │ └── None (20, 0.00e+00)
│ └── δ
├── (1,) (30)
│ ├── c1 (20, 7.20e-03)
│ │ ├── (0,) (15)
│ │ │ └── None (15, 9.77e-04)
│ │ ├── (1,) (5)
│ │ │ ├── None (3, 4.03e-02)
│ │ │ └── fail (2, 4.03e-02)
│ │ └── δ
│ └── c2 (10, 7.20e-03)
│ ├── (0,) (10)
│ │ └── fail (10, 2.07e-03)
│ └── δ
└── δ