所有使用graph

编程入门 行业动态 更新时间:2024-10-09 12:26:46
本文介绍了所有使用graph_tool的最短路径的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我想知道graph_tool中是否有内置函数可用于查找从节点s到节点t的所有最短路径。如果没有,有什么办法可以在某种程度上使用shortest_distance()(在模块graph_tool.topology中)或shortest_path()(在模块graph_tool.topology中)或任何其他内置函数)来计算所有最短路径,而不是只有其中一个(我正在处理一个有大约50万个节点的图)。

解决方案

图形工具中没有这样的功能。请注意,通常情况下,在大图上查找所有最短路径可能是不可行的,因为最短路径的数量会随着图的大小而增加。

更新: all_shortest_paths()函数最近已被添加到库中, :

graph-tool.skewed.de/static/doc/topology.html#graph_tool.topology.all_shortest_paths

I was wondering if there is a built in function in graph_tool that can be used to find all shortest paths from node s to node t.

If not, is there any way that I can use shortest_distance() (in module graph_tool.topology), or shortest_path() (in module graph_tool.topology) somehow (or any other built-in function)to compute all the shortest path instead of only one of them, efficiently (I am working with a graph that has around half a million nodes).

解决方案

There is no such function in graph-tool. Note that in general finding all shortest paths on a large graph will probably be unfeasible, since the number of shortest paths will grow combinatorially with the size of the graph.

UPDATE: The all_shortest_paths() function has been recently added to the library, which does precisely what is requested:

graph-tool.skewed.de/static/doc/topology.html#graph_tool.topology.all_shortest_paths

更多推荐

所有使用graph

本文发布于:2023-11-30 15:13:19,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1650466.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:graph

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!