简体   繁体   English

我可以在“循环”有向图的 BGL 中使用 dijkstra_shortest_paths

[英]Can I use dijkstra_shortest_paths in BGL on "cyclic" directed graph

At first, Sorry for my english :(首先,对不起我的英语:(

my graph's spec is我的图表规格是

  • cyclic循环的
  • directed导演
  • edge weight is positive or zero边权重为正或为零

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.是的,您实际上可以使用该方法。

  1. Dijkstra works with cycles in graphs as long as they are positive Dijkstra 处理图中的循环,只要它们是正的
  2. The documentation of the method states, which does not apply given your specs:该方法的文档说明,根据您的规格,它不适用:

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.

相关问题 dijkstra_shortest_paths Boost Graph Lib 1.57.0失败 - dijkstra_shortest_paths Boost Graph Lib 1.57.0 fails Boost中的自定义图形距离dijkstra_shortest_paths - Custom graph distance in Boost dijkstra_shortest_paths 增强图:dijkstra_shortest_paths:无法形成对“ void”的引用 - Boost graph: dijkstra_shortest_paths: cannot form a reference to 'void' boost :: dijkstra_shortest_paths覆盖内部图形权重? - boost::dijkstra_shortest_paths overwriting internal graph weights? 提升BGL Dijkstra最短路径 - Boost BGL Dijkstra Shortest Paths 用boost :: graph包装我的自定义图并计算dijkstra_shortest_paths - Wrap my custom graph with boost::graph and calculate dijkstra_shortest_paths 当特定节点对之间存在多条最短路径时,boost graph dijkstra_shortest_paths 如何选择最短路径? - How does boost graph dijkstra_shortest_paths pick the shortest path when there are multiple shortest paths between a specific pair of nodes? BGL Dijkstra具有捆绑属性的最短路径 - BGL Dijkstra Shortest Paths with Bundled Properties 如何从 GraphML 获取边权重到 boost::dijkstra_shortest_paths? - How do I get edge weights from GraphML into boost::dijkstra_shortest_paths? 在dijkstra_shortest_paths中使用捆绑属性作为权重映射 - Using bundled properties as the weight map in dijkstra_shortest_paths
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM