Skip to content

Instantly share code, notes, and snippets.

@shirayuca
Last active August 29, 2015 14:05
Show Gist options
  • Save shirayuca/a0ee3d51657f9e5124b5 to your computer and use it in GitHub Desktop.
Save shirayuca/a0ee3d51657f9e5124b5 to your computer and use it in GitHub Desktop.
木グラフの描画と平均経路長算出
# 木グラフを描画し、平均経路長を算出します。
# 頂点の数を 50, 100, 200 と変化させ、作図と平均経路長を算出してみましょう
library(igraph)
graph1 <- graph.tree(20) # 頂点の数は20
plot(graph1) # graph1をプロット
dev.off() # 描画デバイスを閉じる
average.path.length(graph1) # graph1の平均経路長算出
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment