检查有向图是否完整的算法
Algorithm to check if a digraph is complete
是否有已知的算法来检查图是否是 complete digraph?
理想情况下,我想从 JGraphT Java library 中找到一个现成的方法。
或者,我发现 关于无向图的完整性检查。以下修改是否适用于检查有向图的完整性?
- 检查图中有向边的数量是否为
n(n-1)
- 检查每个顶点是否直接连接到
n-1
个不同的顶点
如果我没有遗漏任何东西并且这些条件足够,我可以自己实施这些检查,但如果可能的话我更愿意使用库中的现有实施。
你能试试这个JGraphT方法吗?
它说它也检查二合字母。
Test whether a graph is complete. A complete undirected graph is a
simple graph in which every pair of distinct vertices is connected by
a unique edge. A complete directed graph is a directed graph in which
every pair of distinct vertices is connected by a pair of unique edges
(one in each direction).
如果您的图表没有超过一条边往返于相同的节点,这是最简单的方法。
你不能有一个不完整的图,它有那么多 (n*(n-1))
边 而没有重复的边。
是否有已知的算法来检查图是否是 complete digraph?
理想情况下,我想从 JGraphT Java library 中找到一个现成的方法。
或者,我发现
- 检查图中有向边的数量是否为
n(n-1)
- 检查每个顶点是否直接连接到
n-1
个不同的顶点
如果我没有遗漏任何东西并且这些条件足够,我可以自己实施这些检查,但如果可能的话我更愿意使用库中的现有实施。
你能试试这个JGraphT方法吗?
它说它也检查二合字母。
Test whether a graph is complete. A complete undirected graph is a simple graph in which every pair of distinct vertices is connected by a unique edge. A complete directed graph is a directed graph in which every pair of distinct vertices is connected by a pair of unique edges (one in each direction).
如果您的图表没有超过一条边往返于相同的节点,这是最简单的方法。
你不能有一个不完整的图,它有那么多 (n*(n-1))
边 而没有重复的边。