From 5b8b9f10673f6f583d102f338e3a2e67280826f4 Mon Sep 17 00:00:00 2001 From: Eugene Yurtsev Date: Wed, 19 Mar 2025 16:10:50 -0400 Subject: [PATCH] Update doc-string --- libs/langgraph/langgraph/pregel/algo.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/libs/langgraph/langgraph/pregel/algo.py b/libs/langgraph/langgraph/pregel/algo.py index 5574f4777..c37c95373 100644 --- a/libs/langgraph/langgraph/pregel/algo.py +++ b/libs/langgraph/langgraph/pregel/algo.py @@ -436,8 +436,14 @@ def prepare_next_tasks( manager=manager, ): tasks.append(task) - # If updated channels is available, we project only a subset of the nodes. - # since only those nodes have been updated? + + # This section is an optimization that allows which nodes will be active + # during the next step. + # When there's information about: + # 1. Which channels were updated in the previous step + # 2. Which nodes are triggered by which channels + # Then we can determine which nodes should be triggered in the next step + # without having to cycle through all nodes. if updated_channels and trigger_to_nodes: triggered_nodes: set[str] = set() # Get all nodes that have triggers associated with an updated channel