Skip to content

Commit de934f1

Browse files
committed
Fix a TraceGraph visualization bug that shows extra edges.
1 parent ab1066e commit de934f1

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

opto/trace/propagators/graph_propagator.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
)
1111
from opto.trace.propagators.propagators import Propagator, AbstractFeedback
1212
import heapq
13-
from opto.trace.utils import sum_feedback
13+
from opto.trace.utils import sum_feedback, contain
1414

1515

1616
@dataclass
@@ -103,11 +103,12 @@ def visualize(self, simple_visualization=True, reverse_plot=False, print_limit=1
103103
# and add edge if there's a relationship
104104

105105
# we still use queue here because only lower level node can have a parent to higher level
106+
nodes_in_queue = set([node for level, node in queue])
106107
for level, node in queue:
107108
digraph.node(node.py_name, **nvsg.get_attrs(node))
108109
# is there a faster way to determine child/parent relationship!?
109-
for parent in node.parents:
110-
if self._itemize(parent) in queue:
110+
if all( contain(nodes_in_queue, parent) for parent in node.parents):
111+
for parent in node.parents:
111112
# if there's a parent, add an edge, otherwise no need
112113
edge = (
113114
(node.py_name, parent.py_name)

0 commit comments

Comments
 (0)