from_networkx fails with networkx 2.0
See original GitHub issueHi - When using networkx 2.0 (nx) loading a graph from nx results in a ValueError.
ValueError: expected an element of ColumnData(String, Seq(Any)), got {'index': NodeView((0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33))}
This is because nx 2.0
wraps graph.nodes
in a View. And therefore, from_networkx
code needs to be changed from:
nodes = graph.nodes()
edges = graph.edges()
to:
nodes = dict(graph.nodes())
edges = dict(graph.edges())
Lastly pip nx
is version 2.x on conda it is 1.x. Most people are on 1,x
Issue Analytics
- State:
- Created 6 years ago
- Reactions:1
- Comments:5 (5 by maintainers)
Top Results From Across the Web
Migration guide from 1.X to 2.0 - NetworkX
This is a guide for people moving from NetworkX 1.X to NetworkX 2.0. Any issues with these can be discussed on the mailing...
Read more >NetworkX 2.0 — NetworkX 2.8.8 documentation
We have made major changes to the methods in the Multi/Di/Graph classes. There is a migration guide for people moving from 1.X to...
Read more >NetworkX 2.6 — NetworkX 2.8.8 documentation
Add approximation algorithms for Traveling Salesman Problem ... The variable NIL =”NIL” has been removed from networkx.generators.trees.
Read more >Old Release Log — NetworkX 2.8.8 documentation
See NetworkX 2.0. ... Error with average weighted connectivity for digraphs, correct normalized laplacian with ... from networkx import * ...
Read more >NetworkX Reference
If importing networkx fails, it means that Python cannot find the installed ... They can be imported using from networkx.algorithms import ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@stonebig the fix is more involved we are still investigating
@gryBox we typically try to have PRs and issues separate, you can just put
issues: closes #6971
at the top of the PR