45
45
self.events.append(event)
47
def get_neighbourhood(self, node, depth, check_list ):
47
def get_neighbourhood(self, node, depth, check_list, travers = ["+","-"], node_list=[] ):
48
48
#print "---> ", node
49
if not node.id in check_list:
50
check_list.append(node.id)
52
root.item = copy.copy(node.item)
49
node_list.append(node)
51
root.item = copy.copy(node.item)
55
55
for out in node.outgoing.values():
56
56
root_out = copy.copy(out)
57
57
root_out.first_node = root
58
next = self.get_neighbourhood(root_out.last_node, depth - 1, check_list)
58
next = self.get_neighbourhood(root_out.last_node, depth - 1, check_list, ["+"], node_list)
60
root_out.last_node = next
61
root.outgoing[out.last_node.id] = root_out
60
arrow = root.id+"->"+next.id
61
if not arrow in check_list:
62
check_list.append(arrow)
63
root_out.last_node = next
64
root.outgoing[out.last_node.id] = root_out
63
67
for ins in node.incoming.values():
64
68
root_in = copy.copy(ins)
65
69
root_in.last_node = root
66
prev = self.get_neighbourhood(root_in.first_node, depth - 1, check_list)
70
prev = self.get_neighbourhood(root_in.first_node, depth - 1, check_list, ["-"], node_list)
68
root_in.first_node = prev
69
root.incoming[ins.first_node.id] = root_in
72
arrow = prev.id+"->"+root.id
73
if not arrow in check_list:
74
check_list.append(arrow)
75
root_in.first_node = prev
76
root.incoming[ins.first_node.id] = root_in
75
81
def __init__(self, id):