Support networkx 3.x

Without this patch, there's 2 unit tests failing.

Change-Id: I0b1e6585d2ff68a621c82930f9627801ff2766df
(cherry picked from commit e3ad06efb6)
(cherry picked from commit 825da34435)
This commit is contained in:
Thomas Goirand
2024-05-17 14:09:29 +02:00
committed by Takashi Kajinami
parent 8a8defca72
commit d5ab44e761

View File

@@ -35,7 +35,10 @@ class GraphFormatter(base.SingleFormatter, metaclass=abc.ABCMeta):
# so disable it (currently we don't have real multigraphs) # so disable it (currently we don't have real multigraphs)
self._reformat(data) self._reformat(data)
if nx.__version__ >= '2.0': if nx.__version__ >= '3.0':
graph = json_graph.node_link_graph(
data, name='graph_index')
elif nx.__version__ >= '2.0':
graph = json_graph.node_link_graph( graph = json_graph.node_link_graph(
data, attrs={'name': 'graph_index'}) data, attrs={'name': 'graph_index'})
else: else: