Clique algorithm, or something like that