more compact

This commit is contained in:
2024-10-28 20:01:41 +01:00
parent 7301e7f145
commit d05f03394b
-11
View File
@@ -53,8 +53,6 @@ def classify_iter(g):
('node:start', u, None),
]
print("Stack:", continuations)
while len(continuations) > 0:
state, u, more = continuations.pop()
@@ -63,20 +61,16 @@ def classify_iter(g):
parent = more
print("Recurse:", u, parent)
visited.add(u)
t += 1
start_time[u] = t
if parent is not None:
edges[(parent, u)] = 'tree'
continuations.append(('node:neighbors', u, 0))
elif state == 'node:neighbors':
i = more
print("Remaining Neighbors:", g.neighbors(u)[i:])
neighbors = g.neighbors(u)[i:]
for i in range(len(neighbors)):
@@ -97,11 +91,6 @@ def classify_iter(g):
t += 1
finish_time[u] = t
print("Stack:", continuations)
return edges
# Graph structure