LoginSignup
2
3

More than 5 years have passed since last update.

Rのパッケージigraphのメモ

Last updated at Posted at 2016-09-10

グラフの作り方


  • make_graph
  • make_empty_graph
  • make_ring
  • make_full_graph
  • make_bipartite_graph
  • graph_from_edgelist
  • graph_from_data_frame
  • graph_from_literal

使用例

g <- make_graph(c(1,2,1,3,2,4))

引数は辺を指定する。例では、1->2,1->3,2->4の辺を追加するという意味になる。

eg <- make_empty_graph(5)
eg2 <- eg + edge(1,2,1,3) + edge(2,4)

頂点5個、辺0個のグラフを作り、辺を追加している。

zac <- make_graph('zachary')

文字列を指定して特定のデータからグラフを作ることも可能。例は空手クラブのメンバーの関係らしい。

コミュニティの検出


  • cluster_edge_betweenness
  • cluster_walktrap
  • cluster_spinglass
  • cluster_leading_eigen
  • cluster_fast_greedy
  • cluster_infomap
  • cluster_louvain
  • cluster_optimal

communitiesオブジェクト


上記のコミュニティ検出関数が返すオブジェクト

  • membership 各頂点が属しているコミュニティ
  • length コミュニティの数
  • sizes 各コミュニティの大きさ

頂点、辺の取得


  • V
  • E
  • adjacent_vertices
  • incident_edges 頂点を指定して、接している辺を取得する
  • ends 辺を指定して、両端の頂点を取得する
  • neighbors

距離とか


  • max_flow
  • min_cut
  • distances
  • mean_distance
  • all_shortest_paths
  • page_rank
  • betweenness
  • closeness
  • similarity
  • laplacian
  • max_bipartite_match
  • mst

参考
公式
関数一覧

2
3
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
3