Fix get_root_node function to use vertices instead
of nodes
This commit is contained in:
parent
5c90a9013c
commit
2c79494d8b
1 changed files with 5 additions and 5 deletions
|
|
@ -28,16 +28,16 @@ def extract_input_variables(nodes):
|
|||
return nodes
|
||||
|
||||
|
||||
def get_root_node(graph):
|
||||
def get_root_vertex(graph):
|
||||
"""
|
||||
Returns the root node of the template.
|
||||
"""
|
||||
incoming_edges = {edge.source for edge in graph.edges}
|
||||
incoming_edges = {edge.source_id for edge in graph.edges}
|
||||
|
||||
if not incoming_edges and len(graph.nodes) == 1:
|
||||
return graph.nodes[0]
|
||||
if not incoming_edges and len(graph.vertices) == 1:
|
||||
return graph.vertices[0]
|
||||
|
||||
return next((node for node in graph.nodes if node not in incoming_edges), None)
|
||||
return next((node for node in graph.vertices if node.id not in incoming_edges), None)
|
||||
|
||||
|
||||
def build_json(root, graph) -> Dict:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue