I would like to randomly sample a clique (not necessarily maximal) from an igraph object.
One approach would be:
library(igraph)
G <- erdos.renyi.game(10, .25) #a small graph
cliques <- cliques(G, min=2) #list all cliques
sample(cliques,1) #sample one clique
This works fine for small graphs, but a complete enumeration of cliques is impractical for large or dense graphs.
An alternative might involve sampling a node (randomly or proportional to degree), enumerating the cliques in its neighborhood, then sampling from that list. But, I don't think this would randomly sample from all cliques.
Any suggestions would be appreciated!