for parent in self.predecessors(_node):
visit_list += (parent, "up"),
for child in self.successors(_node):
visit_list += (child, "down"),
elif direction == "down":
if _node not in observed_list:
for child in self.successors(_node):
After Change
while visit_list:
node, direction = visit_list.pop()
if (node, direction) not in traversed_list:
if node not in observed_list:
active_nodes.add(node)
traversed_list.add((node, direction))
if direction == "up" and node not in observed_list:
for parent in self.predecessors(node):
visit_list.add((parent, "up"))