Consider the following example matrix M
M=Uncompress[FromCharacterCode[
Flatten[ImageData[Import["https://i.stack.imgur.com/0cn3H.png"],"Byte"]]]]
M is symmetric and contains values between 0 and 1.
Then, consider chopping off values in M that are smaller than a certain threshold th, while replacing all remaining values by 1, which creates a graph via AdjacencyGraph, i.e.:
th=0.65;
g = AdjacencyGraph[Chop[M, th] /. x_ /; x > 0 -> 1];
With such a graph, we can ask e.g. how many cliques of exactly 12 vertices there are:
FindClique[g, {12}, All]// Length
16
With decreasing th more and more edges are added to the graph, while all edges that were there at a higher th are guaranteed to still be there. The curious thing is, that for th=0.6 the routine above finds 0 cliques, which is lower than the 16 that should at least have been there:
th=0.6;
g = AdjacencyGraph[Chop[M, th] /. x_ /; x > 0 -> 1];
FindClique[g, {12}, All]// Length
0
Is this expected behavior? Maybe the routine ignores sub-cliques that are part of larger sized cliques? (I certainly would not expect that to be the case.) How to make sure to find all previously found cliques and more?
FindCliquefinds maximal cliques, i.e. cliques which are not part of any larger clique. IGraph/M has extensive clique finding and clique counting functionality that you might find useful. – Szabolcs Jan 12 '22 at 19:35