nxviz icon indicating copy to clipboard operation
nxviz copied to clipboard

nxviz doesn't work with networkx 2.4 due to a regression

Open dridk opened this issue 5 years ago • 6 comments

  • nxviz version: 0.6.1
  • Python version: 3.7.4
  • Operating System: Linux

Description

The following example doesn't work with networkx 2.4 :

from random import choice

import matplotlib.pyplot as plt
import networkx as nx
from nxviz.plots import CircosPlot

G = nx.barbell_graph(m1=10, m2=3)
for n, d in G.nodes(data=True):
    G.nodes[n]["class"] = choice(["a", "b", "c", "d", "e"])
    
c = CircosPlot(
    G,
    node_color="class"
)
c.draw()

It returns the following exception:

AttributeError: 'Graph' object has no attribute 'node'

How to solve

I installed networkx 2.3 and it works. As you can see Graph.node is depreacted : https://networkx.github.io/documentation/stable/release/release_2.4.html#deprecations

dridk avatar Jan 28 '20 13:01 dridk

@dridk thanks for raising this. This one sounds like a find-and-replace type of API fix.

If this is urgent, would you be open to putting in a PR? (I'm also looking to expand the project contributors list - and welcome many more contributors to the project.)

If not, I should be able to find a sliver of time this weekend to work on it.

ericmjl avatar Jan 28 '20 17:01 ericmjl

It seems it's already fixed : https://github.com/ericmjl/nxviz/commit/bfb9b10c13209bb7f6047b1ab511bbdeafe4dd2c#diff-70d0d6a0b9b0ece30f133240b5f2dcd1L263

But this modification is not avaible in the last conda package and last pypi

dridk avatar Jan 29 '20 11:01 dridk

hmmm, I might not have cut a release, then. Thanks for the catch and digging in. This one's a patch - the PyPI version will go out within the next 10 minutes, conda-forge might take an hour or so before I see the PR on the conda-forge feedstock.

For now, can you confirm that nxviz on master works with NetworkX 2.4?

ericmjl avatar Jan 29 '20 11:01 ericmjl

FYI, 0.6.2 was just released to PyPI. It's also 6:20 am here, so I'm going to be off this issue tracker while at work.

ericmjl avatar Jan 29 '20 11:01 ericmjl

I confirm it works on master branch and pass all the test.

dridk avatar Jan 29 '20 12:01 dridk

Would you be kind enough to try out the latest conda-forge or PyPI release?

ericmjl avatar Jan 29 '20 16:01 ericmjl