8.1 클릭(Cliques)

클릭(cliques)를 통해 방향성 없는 그래프 전체가 연결된 하위집단을 식별한다.

(무방향 그래프의 완전한 서브 그룹인) 클릭을 찾아보자 : cliques() 함수

cliques(net.sym)                    # 클릭 목록
## [[1]]
## + 1/17 vertex, named, from d81d2a6:
## [1] s03
## 
## [[2]]
## + 1/17 vertex, named, from d81d2a6:
## [1] s06
## 
## [[3]]
## + 1/17 vertex, named, from d81d2a6:
## [1] s14
## 
## [[4]]
## + 1/17 vertex, named, from d81d2a6:
## [1] s09
## 
## [[5]]
## + 1/17 vertex, named, from d81d2a6:
## [1] s04
## 
## [[6]]
## + 2/17 vertices, named, from d81d2a6:
## [1] s04 s06
## 
## [[7]]
## + 2/17 vertices, named, from d81d2a6:
## [1] s03 s04
## 
## [[8]]
## + 1/17 vertex, named, from d81d2a6:
## [1] s05
## 
## [[9]]
## + 2/17 vertices, named, from d81d2a6:
## [1] s05 s09
## 
## [[10]]
## + 2/17 vertices, named, from d81d2a6:
## [1] s03 s05
## 
## [[11]]
## + 1/17 vertex, named, from d81d2a6:
## [1] s13
## 
## [[12]]
## + 2/17 vertices, named, from d81d2a6:
## [1] s13 s14
## 
## [[13]]
## + 1/17 vertex, named, from d81d2a6:
## [1] s10
## 
## [[14]]
## + 2/17 vertices, named, from d81d2a6:
## [1] s09 s10
## 
## [[15]]
## + 2/17 vertices, named, from d81d2a6:
## [1] s03 s10
## 
## [[16]]
## + 1/17 vertex, named, from d81d2a6:
## [1] s16
## 
## [[17]]
## + 2/17 vertices, named, from d81d2a6:
## [1] s06 s16
## 
## [[18]]
## + 1/17 vertex, named, from d81d2a6:
## [1] s08
## 
## [[19]]
## + 2/17 vertices, named, from d81d2a6:
## [1] s08 s09
## 
## [[20]]
## + 2/17 vertices, named, from d81d2a6:
## [1] s03 s08
## 
## [[21]]
## + 1/17 vertex, named, from d81d2a6:
## [1] s01
## 
## [[22]]
## + 2/17 vertices, named, from d81d2a6:
## [1] s01 s05
## 
## [[23]]
## + 3/17 vertices, named, from d81d2a6:
## [1] s01 s03 s05
## 
## [[24]]
## + 2/17 vertices, named, from d81d2a6:
## [1] s01 s04
## 
## [[25]]
## + 3/17 vertices, named, from d81d2a6:
## [1] s01 s03 s04
## 
## [[26]]
## + 2/17 vertices, named, from d81d2a6:
## [1] s01 s03
## 
## [[27]]
## + 1/17 vertex, named, from d81d2a6:
## [1] s17
## 
## [[28]]
## + 2/17 vertices, named, from d81d2a6:
## [1] s16 s17
## 
## [[29]]
## + 3/17 vertices, named, from d81d2a6:
## [1] s06 s16 s17
## 
## [[30]]
## + 2/17 vertices, named, from d81d2a6:
## [1] s13 s17
## 
## [[31]]
## + 2/17 vertices, named, from d81d2a6:
## [1] s04 s17
## 
## [[32]]
## + 3/17 vertices, named, from d81d2a6:
## [1] s04 s06 s17
## 
## [[33]]
## + 2/17 vertices, named, from d81d2a6:
## [1] s06 s17
## 
## [[34]]
## + 1/17 vertex, named, from d81d2a6:
## [1] s12
## 
## [[35]]
## + 2/17 vertices, named, from d81d2a6:
## [1] s12 s13
## 
## [[36]]
## + 3/17 vertices, named, from d81d2a6:
## [1] s12 s13 s14
## 
## [[37]]
## + 2/17 vertices, named, from d81d2a6:
## [1] s04 s12
## 
## [[38]]
## + 3/17 vertices, named, from d81d2a6:
## [1] s04 s06 s12
## 
## [[39]]
## + 3/17 vertices, named, from d81d2a6:
## [1] s03 s04 s12
## 
## [[40]]
## + 2/17 vertices, named, from d81d2a6:
## [1] s12 s14
## 
## [[41]]
## + 2/17 vertices, named, from d81d2a6:
## [1] s06 s12
## 
## [[42]]
## + 2/17 vertices, named, from d81d2a6:
## [1] s03 s12
## 
## [[43]]
## + 1/17 vertex, named, from d81d2a6:
## [1] s11
## 
## [[44]]
## + 2/17 vertices, named, from d81d2a6:
## [1] s04 s11
## 
## [[45]]
## + 3/17 vertices, named, from d81d2a6:
## [1] s03 s04 s11
## 
## [[46]]
## + 2/17 vertices, named, from d81d2a6:
## [1] s11 s14
## 
## [[47]]
## + 2/17 vertices, named, from d81d2a6:
## [1] s03 s11
## 
## [[48]]
## + 1/17 vertex, named, from d81d2a6:
## [1] s07
## 
## [[49]]
## + 2/17 vertices, named, from d81d2a6:
## [1] s07 s08
## 
## [[50]]
## + 3/17 vertices, named, from d81d2a6:
## [1] s03 s07 s08
## 
## [[51]]
## + 2/17 vertices, named, from d81d2a6:
## [1] s07 s10
## 
## [[52]]
## + 3/17 vertices, named, from d81d2a6:
## [1] s03 s07 s10
## 
## [[53]]
## + 2/17 vertices, named, from d81d2a6:
## [1] s07 s14
## 
## [[54]]
## + 2/17 vertices, named, from d81d2a6:
## [1] s03 s07
## 
## [[55]]
## + 1/17 vertex, named, from d81d2a6:
## [1] s15
## 
## [[56]]
## + 2/17 vertices, named, from d81d2a6:
## [1] s01 s15
## 
## [[57]]
## + 3/17 vertices, named, from d81d2a6:
## [1] s01 s05 s15
## 
## [[58]]
## + 3/17 vertices, named, from d81d2a6:
## [1] s01 s04 s15
## 
## [[59]]
## + 2/17 vertices, named, from d81d2a6:
## [1] s05 s15
## 
## [[60]]
## + 2/17 vertices, named, from d81d2a6:
## [1] s04 s15
## 
## [[61]]
## + 3/17 vertices, named, from d81d2a6:
## [1] s04 s06 s15
## 
## [[62]]
## + 2/17 vertices, named, from d81d2a6:
## [1] s06 s15
## 
## [[63]]
## + 1/17 vertex, named, from d81d2a6:
## [1] s02
## 
## [[64]]
## + 2/17 vertices, named, from d81d2a6:
## [1] s01 s02
## 
## [[65]]
## + 3/17 vertices, named, from d81d2a6:
## [1] s01 s02 s05
## 
## [[66]]
## + 4/17 vertices, named, from d81d2a6:
## [1] s01 s02 s03 s05
## 
## [[67]]
## + 3/17 vertices, named, from d81d2a6:
## [1] s01 s02 s03
## 
## [[68]]
## + 2/17 vertices, named, from d81d2a6:
## [1] s02 s10
## 
## [[69]]
## + 3/17 vertices, named, from d81d2a6:
## [1] s02 s09 s10
## 
## [[70]]
## + 3/17 vertices, named, from d81d2a6:
## [1] s02 s03 s10
## 
## [[71]]
## + 2/17 vertices, named, from d81d2a6:
## [1] s02 s05
## 
## [[72]]
## + 3/17 vertices, named, from d81d2a6:
## [1] s02 s05 s09
## 
## [[73]]
## + 3/17 vertices, named, from d81d2a6:
## [1] s02 s03 s05
## 
## [[74]]
## + 2/17 vertices, named, from d81d2a6:
## [1] s02 s09
## 
## [[75]]
## + 2/17 vertices, named, from d81d2a6:
## [1] s02 s03
sapply(cliques(net.sym), length)    # 클릭 크기
##  [1] 1 1 1 1 1 2 2 1 2 2 1 2 1 2 2 1 2 1 2 2 1 2 3 2 3 2 1 2 3 2 2 3 2 1 2 3 2 3
## [39] 3 2 2 2 1 2 3 2 2 1 2 3 2 3 2 2 1 2 3 3 2 2 3 2 1 2 3 4 3 2 3 3 2 3 3 2 2
largest_cliques(net.sym)            # 최대 수의 노드를 갖는 클릭
## [[1]]
## + 4/17 vertices, named, from d81d2a6:
## [1] s03 s01 s02 s05
vcol <- rep("grey80", vcount(net.sym))
vcol[unlist(largest_cliques(net.sym))] <- "gold"

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