k-clique algorithm as defined in the paper "Uncovering the overlapping community structure of complex networks in nature and society" - G. Palla, I. Derényi, I. Farkas, and T. Vicsek - Nature 435, 814–818 (2005)
[X,Y,Z] = k_clique(k,A)
k - clique size
A - adjacency matrix
X - detected communities
Y - all cliques (i.e. complete subgraphs that are not parts of larger complete subgraphs)
Z - k-clique matrix
The result is correct. In fact, the algorithm first extracts all complete subgraphs that are not parts of larger complete subgraphs. These maximal complete subgraphs are called "cliques". I'll modify the description. Thank you.