ggraph学习

graph_from_data_frame(d, directed=TRUE, vertices=NULL)

  • directed: whether or not to create a directed graph;


    转化之后的结果
mygraph <- graph_from_data_frame(connect, vertices = coauth, directed = FALSE ) 
mygraph <- graph_from_data_frame(connect, vertices = coauth, directed = TRUE )
数据查看

数据真实情况

所以,directed=TRUE就是只记录from➡️to的数据(directed);

  • d中from和to两列symbolic edge list都会出现在vertices中;


    coauth数据构成
vertices定义
d和vertices的关系
# Create a graph object with igraph
mygraph <- graph_from_data_frame( connect, vertices = coauth, directed = FALSE )

# Find community
com <- walktrap.community(mygraph)
print(com)
plot(
  com,
  mygraph,
  col = membership(com),
  mark.groups = communities(com),
  edge.color = c("black", "red")[crossing(com, mygraph) + 1]
)
print(com)结果,分成九组

Find community的方法
    1. data in string


      data in string
    1. data in cluster_walktrap


      data in cluster_walktrap

你可能感兴趣的:(ggraph学习)