Skip to content

Commit f7f668e

Browse files
committed
enh(net): shortcut broken_edges if no inputs
1 parent 647d5d7 commit f7f668e

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

graphtik/network.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -692,9 +692,10 @@ def prune(
692692
# To discover which ones to prune, we break their incoming edges
693693
# and they will drop out while collecting ancestors from the outputs.
694694
#
695-
for given in inputs:
696-
broken_edges.update(broken_dag.in_edges(given))
697-
broken_dag.remove_edges_from(broken_edges)
695+
if inputs:
696+
for given in inputs:
697+
broken_edges.update(broken_dag.in_edges(given))
698+
broken_dag.remove_edges_from(broken_edges)
698699

699700
# Drop stray input values and operations (if any).
700701
if outputs is not None:

0 commit comments

Comments
 (0)