Skip to content

Commit 2f12c93

Browse files
committed
fix (visualization.py): fix nxv issue with monkey-patching
1 parent 6bed869 commit 2f12c93

1 file changed

Lines changed: 9 additions & 0 deletions

File tree

src/pyirk/visualization.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,15 @@
1111
import time
1212

1313
import networkx as nx
14+
15+
# monkey-patch workaround because nxv currently is broken for new networkx releases
16+
17+
if not hasattr(nx, "OrderedGraph"):
18+
nx.OrderedGraph = nx.Graph
19+
nx.OrderedDiGraph = nx.DiGraph
20+
nx.OrderedMultiGraph = nx.MultiGraph
21+
nx.OrderedMultiDiGraph = nx.MultiDiGraph
22+
1423
import nxv # for graphviz visualization of networkx graphs
1524

1625
# prevent deprecation warning because nxv is not as up-to-date as nx (of which it depends)

0 commit comments

Comments
 (0)