From f1a1fcbdaa28ae29e28dcaf79c99faa8c5e776f0 Mon Sep 17 00:00:00 2001 From: Gabriel Luiz Freitas Almeida Date: Mon, 4 Mar 2024 00:14:13 -0300 Subject: [PATCH] Document add vertices logic --- src/backend/langflow/graph/graph/base.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/backend/langflow/graph/graph/base.py b/src/backend/langflow/graph/graph/base.py index 8f544fc0c..43d32c176 100644 --- a/src/backend/langflow/graph/graph/base.py +++ b/src/backend/langflow/graph/graph/base.py @@ -287,6 +287,11 @@ class Graph: for vertex_id in removed_vertex_ids: self.remove_vertex(vertex_id) + # The order here matters because adding the vertex is required + # if any of them have edges that point to any of the new vertices + # By adding them first, them adding the edges we ensure that the + # edges have valid vertices to point to + # Add new vertices for vertex_id in new_vertex_ids: new_vertex = other.get_vertex(vertex_id)