From b81dfa2ac3cac9922c542db21364a97217b91ea2 Mon Sep 17 00:00:00 2001 From: Matthew Treinish Date: Thu, 17 Oct 2019 09:41:24 -0400 Subject: [PATCH] Fix number_of_selfloops() call for recent networkx versions The number_of_selfloops() graph method was deprecated in the networkx 2.0 release[1] which was released in 2017 and replaced with a function that provides the same functionality. In the recent 2.4 release this deprecated method has been removed. This commit updates the use of number_of_selfloops to use that function instead of the deprecated and now removed method. It also increases the minimum version supported by the library to use 2.0 which was the version this function was introduced. Fixes #14 [1] https://networkx.github.io/documentation/stable/release/release_2.0.html#api-changes --- nxpd/nx_pydot.py | 2 +- setup.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/nxpd/nx_pydot.py b/nxpd/nx_pydot.py index 1a98b8d..6ffca20 100644 --- a/nxpd/nx_pydot.py +++ b/nxpd/nx_pydot.py @@ -246,7 +246,7 @@ def to_pydot(G, raise_exceptions=True): else: graph_type = 'graph' - strict = G.number_of_selfloops() == 0 and not G.is_multigraph() + strict = nx.number_of_selfloops(G) == 0 and not G.is_multigraph() # Create the Pydot graph. name = G.graph.get('name') diff --git a/setup.py b/setup.py index 845ae94..bb4c9ef 100644 --- a/setup.py +++ b/setup.py @@ -19,7 +19,7 @@ def main(): install_requires = [ - 'networkx >= 1.6', + 'networkx >= 2.0', 'pyparsing >= 2.0.1', ]