0

I would like to know if there is a proper algorithm to group nodes for the following problem:

Input: Relational disconnected graph, with following data structure:

per_id com_id

 1        1
 2        1
 2        2
 3        2
 3        3
 4        3
 5        7
 5        8
 6        7

Output: Cluster all persons which have a directed/undirected relation, taken as reference the company attribute in a force layout graph (D3.js). The output of the example above would be to draw a circle/bubble force layout graph with 2 bubbles containing the following persons:

Group 1 = {1, 2, 3, 4}

Group 2 = {5, 6}

Force Layout Graph example

Has QUIT--Anony-Mousse
  • 76,138
  • 12
  • 138
  • 194
user12282
  • 135
  • 1
  • 2
  • 9
  • Can you specify your problem in general? One example is not a replacement for a specification of the task. We need to know what the correct output is, as a function of the input. Thanks. – Mario Cervera Sep 06 '16 at 21:35
  • I update my problem, maybe it is more clear now – user12282 Sep 07 '16 at 08:05

1 Answers1

0

Aren't you simply looking for the GROUP_BY com_id SQL operarion?

Group all persons in each company?

How would your expected result differ from this classic relational operation?

Has QUIT--Anony-Mousse
  • 76,138
  • 12
  • 138
  • 194