4
votes

I'm not sure if I'm using the right term here, but for fully connected components I mean there's an (undirected) edge between every pair of vertices in a component, and no additional vertices can be included without breaking this property.

There're a number algorithms for finding strongly connected components in a graph though (for example Tarjan's algorithm), is there an algorithm for finding such "fully connected components"?

1
Edge ? directed or undirected ? - sunkuet02
@AbdullaAlSun undirected :) - dontloo
This is the clique problem, and it's NP-hard if you want to find the largest such subgraph. - G. Bach
@user31264 "maximal" means you can't add anything without breaking the property, and that's easy to find. You want "maximum", which means largest. - G. Bach
... and if you really do want maximal cliques (sometimes you do), you can use the Bron-Kerbosch algorithm. But be aware that there can be up to 3^(n/3) of them in an n-vertex graph. - j_random_hacker

1 Answers

3
votes

What you are looking for is a list of all the maximal cliques of the graph. It's also called the clique problem. No known polynomial time solution exists for a generic undirected graph.

Most versions of the clique problem are 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. Therefore, much of the theory about the clique problem is devoted to identifying special types of graph that admit more efficient algorithms, or to establishing the computational difficulty of the general problem in various models of computation.

-https://en.wikipedia.org/wiki/Clique_problem

I was also looking at the same question.

https://en.wikipedia.org/wiki/Bron-Kerbosch_algorithm This turns out to be an algorithm to list it, however, it's not fast. If your graph is sparse, you may want to use the vertex ordering version of the algorithm:

For sparse graphs, tighter bounds are possible. In particular the vertex-ordering version of the Bron–Kerbosch algorithm can be made to run in time O(dn3d/3), where d is the degeneracy of the graph, a measure of its sparseness. There exist d-degenerate graphs for which the total number of maximal cliques is (n − d)3d/3, so this bound is close to tight.[6]