fix: update sort logic to handle cycles when running component (#4957)
fix: handle cycle scenario by adjusting stop component logic in graph sorting Co-authored-by: anovazzi1 <otavio2204@gmail.com>
This commit is contained in:
parent
22482d7258
commit
df7ee68210
1 changed files with 5 additions and 0 deletions
|
|
@ -2009,6 +2009,11 @@ class Graph:
|
|||
) -> list[str]:
|
||||
"""Sorts the vertices in the graph."""
|
||||
self.mark_all_vertices("ACTIVE")
|
||||
if stop_component_id in self.cycle_vertices:
|
||||
# Make the stop into a start because we are in a cycle and
|
||||
# we cannot know where is the input or output
|
||||
start_component_id = stop_component_id
|
||||
stop_component_id = None
|
||||
if stop_component_id is not None:
|
||||
self.stop_vertex = stop_component_id
|
||||
vertices = self.__filter_vertices(stop_component_id)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue