I used the following commands (in qgis console) to get the shortest path with astar algorithm. But the result shows 'NetworkXNoPath' every time. Why was that? Please help me to find a solution to this problem.
>>>import networkx as nx >>>G = nx.read_shp(str(iface.mapCanvas().currentLayer().source())) >>>len(G.edges()) 18562 >>>route = nx.shortest_path(G, G.nodes(), G.nodes()) Traceback (most recent call last): File "<input>", line 1, in <module> File "/usr/local/lib/python2.7/dist-packages/networkx/algorithms/shortest_paths/generic.py", line 136, in shortest_path File "/usr/local/lib/python2.7/dist-packages/networkx/algorithms/shortest_paths/unweighted.py", line 138, in bidirectional_shortest_path File "/usr/local/lib/python2.7/dist-packages/networkx/algorithms/shortest_paths/unweighted.py", line 203, in _bidirectional_pred_succ NetworkXNoPath: No path between (106.8249296, -6.2047544) and (106.7920071, -6.2245956).