[英]Can I use dijkstra_shortest_paths in BGL on "cyclic" directed graph
At first, Sorry for my english :(首先,对不起我的英语:(
my graph's spec is我的图表规格是
As I know dijsktra algorithm cannot find shortest path of "cyclic" graph.据我所知,dijsktra 算法找不到“循环”图的最短路径。 But there is no that restriction in BGL docs ( https://www.boost.org/doc/libs/1_77_0/libs/graph/doc/dijkstra_shortest_paths.html )但是 BGL 文档中没有这个限制( https://www.boost.org/doc/libs/1_77_0/libs/graph/doc/dijkstra_shortest_paths.html )
So I wonder I can find shortest paths of this graph by using dijkstra_shortest_paths in BGL.所以我想知道我可以通过在 BGL 中使用 dijkstra_shortest_paths 来找到这个图的最短路径。
thanks.谢谢。
Yes, you can in fact use the method.是的,您实际上可以使用该方法。
Use the Bellman-Ford algorithm for the case when some edge weights are negative对于某些边权重为负的情况,请使用 Bellman-Ford 算法
See also https://cs.stackexchange.com/questions/101637/dijkstra-s-shortest-path-algorithm另见https://cs.stackexchange.com/questions/101637/dijkstra-s-shortest-path-algorithm
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.