mirror of
https://github.com/langchain-ai/langgraph.git
synced 2026-08-20 22:52:29 +02:00
Remove labels if redundant
This commit is contained in:
@@ -450,13 +450,21 @@ class CompiledGraph(Pregel):
|
||||
)
|
||||
graph.add_edge(start_nodes[start], cond)
|
||||
for label, end in ends.items():
|
||||
graph.add_edge(cond, end_nodes[end], label, conditional=True)
|
||||
graph.add_edge(
|
||||
cond,
|
||||
end_nodes[end],
|
||||
label if label != end else None,
|
||||
conditional=True,
|
||||
)
|
||||
if branch.then is not None:
|
||||
graph.add_edge(start_nodes[end], end_nodes[branch.then])
|
||||
else:
|
||||
for label, end in ends.items():
|
||||
graph.add_edge(
|
||||
start_nodes[start], end_nodes[end], label, conditional=True
|
||||
start_nodes[start],
|
||||
end_nodes[end],
|
||||
label if label != end else None,
|
||||
conditional=True,
|
||||
)
|
||||
if branch.then is not None:
|
||||
graph.add_edge(start_nodes[end], end_nodes[branch.then])
|
||||
|
||||
Reference in New Issue
Block a user