-3

I have a friendship graph as followsFriendship graph

I want to find all the possible group of friends. What is the best algorithm to find these grouping. For example in this graph , possible friendship groups are as follows: 1,2,3,4,12,13,23,123,14,143,124,1234

If I use brute-force algorithm (starting from each vertex and do this 4 times), it generates lots of duplicates.

xenteros
  • 15,586
  • 12
  • 56
  • 91
NARAYAN CHANGDER
  • 319
  • 4
  • 13
  • could you provide a format for your graph data ? –  Sep 28 '16 at 15:48
  • note that the most interesting question would be, how to find a linear algorithm which introduces the fewest number of errors ( and defining an error count function ) –  Sep 28 '16 at 15:54
  • @igael I would prefer to store it as adjacency list because graph could be sparse in most cases. – NARAYAN CHANGDER Sep 28 '16 at 16:10
  • no problem, provide a format ( while the question remains : *"find the number"* and not *"enumerate them"* ) –  Sep 28 '16 at 16:21

1 Answers1

1

According to the Wikipedia it's NP-complete so you can only use brute-force for detecting such sets. The problem is called Clique problem and is one of first identified NP-complete problems.

xenteros
  • 15,586
  • 12
  • 56
  • 91