美文网首页
ggraph学习

ggraph学习

作者: MJades | 来源:发表于2020-05-08 19:05 被阅读0次

    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学习

          本文链接:https://www.haomeiwen.com/subject/hxvxnhtx.html