Jelly, 15 18 1816 bytes
+3 bytes to fix bugs in my method.
-2 bytes thanks to miles (noting that n×(n-1)÷2 = nC2)
QL×’$⁼LẎQL©c2⁼Lȧ®
ŒPẎ€ÇÐfṪQLŒPÇ€Ṁ
Try it online!Try it online! forms the power-set of the edges in memory so is inefficient both in space and time (yep,that's O(2n) folks)!
QL×’$⁼LẎQL©c2⁼Lȧ® - Link 1, isClique?: list, flattenedEdgesedges e.g. [1[[1,33],2[2,33],3[3,44],4[4,11],4[4,22],2[2,1]1]]
Ẏ - tighten ...from: [[1 [ 1,3]3 ,[2 2,3]3 ,[3 3,4]4 ,[4 4,1]1 ,[4 4,2]2 ,[2 2,1]]1 ]
Q - de-duplicate (gets unique ids) [1,3,2,4]
L - length (get number of people involved) 4
© 4
$- (copy to -the lastregister)
two links as ac2 monad:
’ - combinations of 2 (z-choose-2) decrement 6
L - length (of edges) 3
× - 6
multiply ⁼ - equal? 12
L -1
length (of flattenedEdges) ® - recall value from register 12
⁼4
- equal? ȧ - logical and 4
1
- (Note: the number of edges of a clique of size n is n*(n-1) and we're
- guaranteed no repeated edges and that all edges are two distinct ids)
ŒPẎ€ÇÐfṪQLŒPÇ€Ṁ - Link: list of lists, edges
ŒP - power-set (all possible sets of edges (as lists))
Ẏ€ - tighten €ach (flattens each list of edges to a list of the ids)
Ðf - filter keep those for which this is truthy:
Ç Ç€ - call last link (1) as a monad
Ṫ - tail (get the rightmost, note that ŒP is ordered by length)
Q - de-duplicate (get the uniquefor ids)€ach
LṀ - length (the number of friends in (one of the) largest clique(s))maximum