Exemplo n.º 1
0
def test_is_forking_point():
    t = Tree(0)
    t.add_child(Tree(1))
    t.add_child(Tree(2))
    nt.ok_(is_forking_point(t))
    t.add_child(Tree(3))
    nt.ok_(is_forking_point(t))
Exemplo n.º 2
0
def test_is_forking_point():
    t = Tree(0)
    t.add_child(Tree(1))
    t.add_child(Tree(2))
    nt.ok_(is_forking_point(t))
    t.add_child(Tree(3))
    nt.ok_(is_forking_point(t))
Exemplo n.º 3
0
def branch_order(tree_section):
    '''Branching order of a tree section

    The branching order is defined as the depth of the tree section.

    Note:
        The first level has branch order 0.
    '''
    node = tree_section[-1]
    bo = sum(1 for _ in tr.iforking_point(node, tr.iupstream))
    return bo - 2 if tr.is_forking_point(node) else bo - 1
Exemplo n.º 4
0
def branch_order(tree_section):
    '''Branching order of a tree section

    The branching order is defined as the depth of the tree section.

    Note:
        The first level has branch order 0.
    '''
    node = tree_section[-1]
    bo = sum(1 for _ in tr.iforking_point(node, tr.iupstream))
    return bo - 2 if tr.is_forking_point(node) else bo - 1
Exemplo n.º 5
0
def test_is_forking_point_false():
    t = Tree(0)
    nt.ok_(not is_forking_point(t))
    t.add_child(Tree(1))
    nt.ok_(not is_forking_point(t))
Exemplo n.º 6
0
def test_is_forking_point_false():
    t = Tree(0)
    nt.ok_(not is_forking_point(t))
    t.add_child(Tree(1))
    nt.ok_(not is_forking_point(t))