Esempio n. 1
0
def depth_all_path(id):
    print '-'*100+'depth_all_path matching..',id
    all_path = []

    #done visited path
    path_stack = Stack()
    #undo unvisited stack
    stack = Stack()
    stack.push(id)
    while not stack.isEmpty():
        subId = stack.pop()
        #print'subId:',subId
        if is_leaf(subId):
            #print subId,' is leaf,end'
            path_stack.push(subId)
            #path_stack.show()
            leaf_path = path_stack.build_list()
            all_path.append(leaf_path)
            #all_path.append(path_stack.data())

            path_stack = rebuild_path_stack(path_stack,stack)
            #print '---after rebuild---'
            #path_stack.show()
            #stack.show()
        else:
            path_stack.push(subId)
            childs =  tree[subId][1]
            for _id in childs:
                #depth_order2(stack,_id)
                stack.push(_id)
            #stack.show()
    #print all_path
    return all_path