fix(base.py): only add successors if is_start (#2513)
This commit is contained in:
parent
15aa68a342
commit
bf5e7b343a
1 changed files with 3 additions and 1 deletions
|
|
@ -1236,9 +1236,11 @@ class Graph:
|
||||||
stack.append(successor.id)
|
stack.append(successor.id)
|
||||||
else:
|
else:
|
||||||
excluded.add(successor.id)
|
excluded.add(successor.id)
|
||||||
elif current_id not in stop_predecessors:
|
elif current_id not in stop_predecessors and is_start:
|
||||||
# If the current vertex is not the target vertex, we should add all its successors
|
# If the current vertex is not the target vertex, we should add all its successors
|
||||||
# to the stack if they are not in visited
|
# to the stack if they are not in visited
|
||||||
|
|
||||||
|
# If we are starting from the beginning, we should add all successors
|
||||||
for successor in current_vertex.successors:
|
for successor in current_vertex.successors:
|
||||||
if successor.id not in visited:
|
if successor.id not in visited:
|
||||||
stack.append(successor.id)
|
stack.append(successor.id)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue