question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

from_networkx fails with networkx 2.0

See original GitHub issue

Hi - 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:closed
  • Created 6 years ago
  • Reactions:1
  • Comments:5 (5 by maintainers)

github_iconTop GitHub Comments

2reactions
bryevdvcommented, Oct 10, 2017

@stonebig the fix is more involved we are still investigating

0reactions
bryevdvcommented, Oct 10, 2017

@gryBox we typically try to have PRs and issues separate, you can just put issues: closes #6971 at the top of the PR

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found