Skip to content

Commit

Permalink
Fix number_of_selfloops() call for recent networkx versions
Browse files Browse the repository at this point in the history
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 chebee7i#14

[1] https://networkx.github.io/documentation/stable/release/release_2.0.html#api-changes
  • Loading branch information
mtreinish committed Oct 17, 2019
1 parent a0797cd commit b81dfa2
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion nxpd/nx_pydot.py
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
def main():

install_requires = [
'networkx >= 1.6',
'networkx >= 2.0',
'pyparsing >= 2.0.1',
]

Expand Down

0 comments on commit b81dfa2

Please sign in to comment.