Remove labels if redundant

This commit is contained in:
Nuno Campos
2024-04-29 10:44:45 -07:00
parent a83fd19b29
commit 4a28f19922
+10 -2
View File
@@ -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])