查找图中所有完整的子图

发布于 2024-09-01 02:33:56 字数 99 浏览 14 评论 0原文

是否有已知的算法或方法来查找图中的所有完整子图?我有一个无向、未加权的图,我需要找到其中的所有子图,其中子图中的每个节点都连接到子图中的每个其他节点。

有现成的算法吗?

Is there a known algorithm or method to find all complete sub-graphs within a graph? I have an undirected, unweighted graph and I need to find all subgraphs within it where each node in the subgraph is connected to each other node in the subgraph.

Is there an existing algorithm for this?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

蒗幽 2024-09-08 02:33:56

这被称为派系问题;这很困难,而且一般来说是 NP 完全的,是的,有很多算法可以做到这一点。

如果图具有额外的属性(例如,它是二分图),那么问题就会变得相当容易,并且可以在多项式时间内解决,但否则它就非常困难,并且仅对于小图才能完全解决。

来自维基百科

在计算机科学中,派问题是指与在图中查找特定完整子图(“派”)相关的任何问题,即每对元素相连的元素集。

派系问题包括:

  • 找到最大团(顶点数最多的团),
  • 在加权图中找到最大权重团,
  • 列出所有最大派系(无法扩大的派系)
  • 解决测试图是否包含大于给定大小的团的决策问题。

这些问题都很困难:派系决策问题是 NP 完全问题(卡普的 21 个 NP 完全问题之一),寻找最大派系的问题既是固定参数棘手的又难以近似,并且列出所有最大值派系可能需要指数时间,因为存在具有指数级多个最大派系的图。然而,针对这些问题的算法可以在指数时间内运行,或者在多项式时间内处理某些更专业的输入图。

另请参阅

This is known as the clique problem; it's hard and is in NP-complete in general, and yes there are many algorithms to do this.

If the graph has additional properties (e.g. it's bipartite), then the problem becomes considerably easier and is solvable in polynomial time, but otherwise it's very hard, and is completely solvable only for small graphs.

From Wikipedia

In computer science, the clique problem refers to any of the problems related to finding particular complete subgraphs ("cliques") in a graph, i.e., sets of elements where each pair of elements is connected.

Clique problems include:

  • finding the maximum clique (a clique with the largest number of vertices),
  • finding a maximum weight clique in a weighted graph,
  • listing all maximal cliques (cliques that cannot be enlarged)
  • solving the decision problem of testing whether a graph contains a clique larger than a given size.

These problems are all hard: the clique decision problem is NP-complete (one of Karp's 21 NP-complete problems), the problem of finding the maximum clique is both fixed-parameter intractable and hard to approximate, and listing all maximal cliques may require exponential time as there exist graphs with exponentially many maximal cliques. Nevertheless, there are algorithms for these problems that run in exponential time or that handle certain more specialized input graphs in polynomial time.

See also

已下线请稍等 2024-09-08 02:33:56

在大小为 n 的图中找到 k 顶点子图的问题很复杂

O(n^kk^2)

因为有 n^k 个子图需要检查,并且每个子图都有 k^2 条边。

您所要求的,查找图中的所有子图是一个 NP 完全问题,并在上​​面列出的 Bron-Kerbosch 算法中进行了解释。

Well the problem of finding a k-vertex subgraph in a graph of size n is of complexity

O(n^k k^2)

Since there are n^k subgraphs to check and each of them have k^2 edges.

What you are asking for, finding all subgraphs in a graph is a NP-complete problem and is explained in the Bron-Kerbosch algorithm listed above.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文