68 for current in stage: |
68 for current in stage: |
69 currentParents = parents.get(current, []) |
69 currentParents = parents.get(current, []) |
70 for parent in currentParents: |
70 for parent in currentParents: |
71 if parent in stage and parent != current: |
71 if parent in stage and parent != current: |
72 # might wind up removing current |
72 # might wind up removing current |
73 if not current in parents.get(parent, []): |
73 if current not in parents.get(parent, []): |
74 # is not mutually dependant |
74 # is not mutually dependant |
75 removes.append(current) |
75 removes.append(current) |
76 |
76 |
77 for remove in removes: |
77 for remove in removes: |
78 while remove in stage: |
78 while remove in stage: |
103 childrenTable = {} |
103 childrenTable = {} |
104 parentTable = {} |
104 parentTable = {} |
105 for sourceID, destinationID in routes: |
105 for sourceID, destinationID in routes: |
106 currentChildren = childrenTable.get(sourceID, []) |
106 currentChildren = childrenTable.get(sourceID, []) |
107 currentParents = parentTable.get(destinationID, []) |
107 currentParents = parentTable.get(destinationID, []) |
108 if not destinationID in currentChildren: |
108 if destinationID not in currentChildren: |
109 currentChildren.append(destinationID) |
109 currentChildren.append(destinationID) |
110 if not sourceID in currentParents: |
110 if sourceID not in currentParents: |
111 currentParents.append(sourceID) |
111 currentParents.append(sourceID) |
112 childrenTable[sourceID] = currentChildren |
112 childrenTable[sourceID] = currentChildren |
113 parentTable[destinationID] = currentParents |
113 parentTable[destinationID] = currentParents |
114 return childrenTable, parentTable |
114 return childrenTable, parentTable |