1

The task is to identify cliques (complete sub-graphs where any two nodes are linked) in R, subject to the constraint that each node is only assign once. Here is an example data set:

from    to
s01     s02    
s02     s03    
s03     s01    
s01     s04    
s02     s04    
s03     s04    
s03     s05    
s03     s06    
s03     s07    
s03     s08    
s05     s06    
s05     s07    
s05     s08    
s06     s07
s06     s08
s07     s08

It looks like this after ploting: enter image description here

Finding cliques

max_cliques(graph1,min=4)

I get two cliques, they are: [s02 s01 s04 s03] and [s06 s03 s08 s07 s05]

To show it visually:

plot(graph1, vertex.label=V(net.sym)$name, vertex.color=vcol)

enter image description here

It can be seen that s03 is assigned to both cliques. However, I would like each node to be assigned only once.

What I want is something like this: enter image description here

Using the command largest_cliques to find the largest clique won't work because it only gives the largest cliques, and in my real data set, there are thousands of nodes and edges. Can somebody show me how to address this problem?

ochs.tobi
  • 3,214
  • 7
  • 31
  • 52
Wei
  • 11
  • 1

0 Answers0