【发布时间】:2020-07-04 00:49:17
【问题描述】:
我有兴趣找到从所有点到网络中特定点的最短路径。到目前为止,我一直在通过循环所有点来计算最短路径来估计这一点。
随着网络规模的增加,这种方法的计算成本会很高。有没有有效的替代方案?我忽略了 NetworkX 中的任何内容?
# Pseudocode
For a_node in list_of_nodes:
shortest_path_to_poi = nx.shortest_path(G, source=a_node, target=poi, method='dijkstra')
感谢您的时间和考虑。
【问题讨论】:
-
这能回答你的问题吗? how to get shortest path in networkX
-
一种优化是跳过已经在某个路径上的源节点。
标签: python networkx graph-theory