3D 커뮤니티 네트워크 그래프
이제 마지막으로, fast-greedy 커뮤니티 탐지 방법으로 얻은 커뮤니티 소속 정보를 바탕으로 정점들을 배치한, threejs 대화형 플롯을 만들어 보겠습니다.
이 연습은 강의의 일부입니다
R로 하는 네트워크 분석
연습 안내
- 커뮤니티 igraph 객체
kc에 대해membership()함수를 사용해 각 정점의 커뮤니티 소속 벡터를 생성하세요. - 커뮤니티 igraph 객체
kc에서sizes()함수를 사용해 커뮤니티가 몇 개인지 확인하세요. set_vertex_attr()를 사용해 그래프 객체g에color라는 정점 속성을 추가하세요. 추가할 값은 객체i에 있는 소속 정보를 바탕으로 한 색상입니다.- 네트워크 객체
g에graphjs()함수를 사용해 3차원 그래프를 그리세요.
실습형 인터랙티브 연습
이 예제를 이 샘플 코드를 완성하여 풀어보세요.
# Create an object 'i' containin the memberships of the fast-greedy community detection
i <- ___(kc)
# Check the number of different communities
___(kc)
# Add a color attribute to each vertex, setting the vertex color based on community membership
g <- ___(___, "___", value = c("yellow", "blue", "red")[i])
# Plot the graph using threejs
___(___)