szhorvat / IGraphM

IGraph/M is the igraph interface for Mathematica
http://szhorvat.net/mathematica/IGraphM
Other
91 stars 17 forks source link

Count all cliques of a fixed size #134

Closed lichengzhang2 closed 1 month ago

lichengzhang2 commented 1 month ago

IGCliqueSizeCounts can compute the number of all k-cliques, but if I only want the count of cliques of a fixed size, I feel that usingIGCliqueSizeCounts[graph][k] is well but it might lead to overcounting additional cliques.

I'm wondering whether calculating the number of k-cliques depends on the sizes of other cliques in your function.

szhorvat commented 1 month ago

To count size-$k$ cliques, use IGCliqueSizeCounts[graph, {k}].

I'm afraid I don't quite understand the question. Restricting the search to size-$k$ cliques only should be faster than doing the search for all cliques and then taking the result for size-$k$ only.

lichengzhang2 commented 1 month ago

Thank you! I hadn't noticed the option you mention. I thought it must provide the number of cliques of every size, and then select the number of cliques of size $k$ . Now I think it is not the case.