Support networkx 3.x

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

Change-Id: I0b1e6585d2ff68a621c82930f9627801ff2766df
This commit is contained in:
Thomas Goirand 2024-05-17 14:09:29 +02:00
parent 5bec5fbd54
commit e3ad06efb6

View File

@ -35,7 +35,10 @@ class GraphFormatter(base.SingleFormatter, metaclass=abc.ABCMeta):
# so disable it (currently we don't have real multigraphs)
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(
data, attrs={'name': 'graph_index'})
else: