Path between two nodes

后端 未结 3 835
后悔当初
后悔当初 2020-12-01 13:31

I\'m using networkx to work with graphs. I have pretty large graph (it\'s near 200 nodes in it) and I try to find all possible paths between two nodes. But, as I understand,

3条回答
  •  臣服心动
    2020-12-01 13:50

    Dijkstra's algorithm will find the shortest path in a manner similar to a breadth first search (it substitutes a priority queue weighted by depth into the graph for the naive queue of a BFS). You could fairly trivially extend it to produce the 'N' shortest paths if you need some number of alternatives, although if you need the paths to be substantially different (e.g. scheduling the routes of security vans) you might need to be more clever about selecting paths that are significantly different from each other.

提交回复
热议问题