Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

florentine_families.ipynb example has errors when used with networkx >= 2.4 #21

Open
thisisnic opened this issue Feb 4, 2021 · 1 comment

Comments

@thisisnic
Copy link

thisisnic commented Feb 4, 2021

In networkx >= 2.4, the Graph.node function has been deprecated in favour of Graph.nodes (see https://networkx.org/documentation/stable/release/release_2.4.html#deprecations).

This means that when using versions of networkx greater or equal to 2.4, when running the florentime_families example notebook, the code chunk pasted below results in an error:

for f in G.nodes():
    for i, c in enumerate(communities):
        if f in c:
            G.node[f].update({"community" : str(i),
                                "centrality" : centralities[f],
                                "name" : f
                               })

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

It can be fixed by changing the bit that says G.node[f].update to G.nodes[f].update, though I'm not sure if a bigger change involving refactoring the code a little and using G.set_node_attributes() instead might be a better solution that works on all versions.

If it'd be helpful, I could submit a PR with one of the suggested fixes?

@T-Flet
Copy link

T-Flet commented Jun 8, 2024

This issue is fixed in my fork (which was originally made precisely to have a version with fixes from issues and PRs).

The fork has now been detached and released as its own library, altair-nx, because the original has been inactive since 2020 and because the fork diverged from it considerably after a full code-base rework and the implementation of new features (e.g. curved edges, self loops, and much greater customisability).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants