gboeing / osmnx-examples

Gallery of OSMnx tutorials, usage examples, and feature demonstations.
https://osmnx.readthedocs.io
MIT License
1.52k stars 521 forks source link

NetworkXNotImplemented in 08-example-line-graph #6

Closed philippks closed 6 years ago

philippks commented 6 years ago

Example 08-example-line-graph seems not to work anymore.

When executing with mybinder.org, I get an error:

image

Did something change or am I missing something?

gboeing commented 6 years ago

@philippks everything should be working fine. That notebook just run without problem on my machine. Make sure your packages are all up-to-date and try again? If you're still having trouble, please open an issue in the OSMnx repo with details about your platform, package versions, etc and we'll troubleshoot.

philippks commented 6 years ago

Thank you for your fast reply @gboeing.

osmnx 0.7.3 depends on networkx 2.1, where this PR wrongly added the annotation @not_implemented_for('multigraph') to the method line_graph. This change was corrected with this PR (which is not yet released).

Therefore, the notebook only executes on my machine when downgrading osmnx to 0.7.1.

It is strange that the notebook works fine on your machine (do you've the newest versions installed?). Feel free to close this issue, but I believe the problem is not solved until networkx is upgraded to 2.2.

gboeing commented 6 years ago

@philippks thanks for tracking that down! That explains it... I had run that notebook just now using the nx 2.2 release candidate.

Would you like to add a comment to that notebook cell regarding the version number needed, given this bug, and open a PR?

philippks commented 6 years ago

:+1: I created a PR. Thanks for your great work btw.

gboeing commented 6 years ago

@philippks thanks!

dvu4 commented 6 years ago

Hi Geoff,

can we plot the colored edges with closeness centralities in the folium ?

I convert multigraph to line_graph in order to compute edge closeness centrality

GG = nx.Graph()

for node, neighbors in G.adjacency(): # Return (node, adjacency dict) tuples for all nodes. for neighbor, edict in neighbors.items(): GG.add_edge(node, neighbor)

edge_centrality = nx.closeness_centrality(nx.line_graph(GG))

But number of edges in multigraph is different from those in line_graph