-
Notifications
You must be signed in to change notification settings - Fork 14
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
AttributeError: module 'networkx' has no attribute 'connected_component_subgraphs' #25
Comments
experiencing the same on macOS🥲 |
turns out unlike I've read somewhere qgis does install it's own python interpter. I've run I did encounter another issue though but thankfully it was an easy fix. qgis comes with python3.9 which has moved some function called gcd from a module named fractions to math. I've changed in a file named dag.py |
@MgTheProgrammer How did you run the QGIS version of PIP? I tried running in from a Windows command prompt in the directory that pip.exe is installed in under QGIS, but get a fatal python error and no module named encodings. |
@MgTheProgrammer I also tried:
But got tons of errors. Next I tried:
But this crashes QGIS (I opened, re-ran the import and called it again and it crashes every time) Another thing I tried was running this from the QGIS python directory:
But this failed with a message |
@michael-ts I opened qgis now as you reminded me about this. And weirdly enough it doesn't work correctly, it gives me a path and concludes that its length is 0 km. I'm pretty sure last time I've played with it, it worked though. So I guess it's more related to something wrong with the input I give from qgis. |
Btw if what you are looking for is mostly an optimized route and less about specifically using it with qgis. This repo works without much effort from you as a user. It does give a bit less control but it's good enough imo. |
@MgTheProgrammer Thanks, I'm looking at this and it looks like it might be helpful at least until I can figure out how to get the QGIS plug-in working. I noticed a couple of issues which using QGIS may or may not solve:
|
@MgTheProgrammer Also, it seems to be brute-forcing the solution. I thought there was a polynomial time solution; this isn't the travelling salesman problem... |
@MgTheProgrammer It's also not clear to me how to find the actual route... I downloaded the GPX file (was the only option offered). I tried to download it into Google Maps but it claimed (wrongly) that the GPX file was bad. I found a GPX to KML convertor but when I look at the route on the map it shows all the streets reached but I can't tell in what order to visit them. I found an online GPX editor and I can tell the route but only by dragging a slider and this would be a pain to try to manually transcribe into something like turn by turn directions. What method do you use? |
Following modification to def graph_components(graph):
# The graph may contain multiple components, but we can only handle one connected component. If the graph contains
# more than one connected component, we only use the largest one.
components = list((graph.subgraph(c) for c in nx.connected_components(graph))) #list(nx.connected_component_subgraphs(graph)) <-- this is deprecated
components.sort(key=lambda c: c.size(), reverse=True)
return components |
I read #21 .
Doing
pip install --force-reinstall networkx==2.3
on Command Prompt for Windows operating system and Terminal on Linux operating system does not solve the problem when using it as a plugin for QGIS Desktop software.
The text was updated successfully, but these errors were encountered: