【发布时间】:2009-10-29 07:37:55
【问题描述】:
可能重复:
Graph Algorithm To Find All Connections Between Two Arbitrary Vertices
我有一个有向图,我可以使用什么算法来查找 2 个特定顶点之间的不同非循环路径的数量,并计算在这些不同路径中使用任何路径的最大次数? 如果两条路径访问不同数量的顶点或以不同的顺序访问顶点,则它们是不同的。
【问题讨论】:
-
恕我直言,这不必是重复的。知道值的数量(整数)和知道所有的值(一组节点列表)是有区别的。出于我的目的,即使是对数字(上限)的合理猜测也是可以的,所以对我来说这不是重复的。
-
Graph Algorithm To Find All Connections Between Two Arbitrary Vertices 根本不是重复的:枚举和计数是不同的问题,有向图与无向图是不同的野兽。关于计算简单路径的复杂性,请参阅 How hard is counting the number of simple paths between two nodes in a directed graph? on Computer Science。
-
我同意 Danatel 的观点 - 对于大图,不希望枚举所有可能的路径。