Skip to content

Instantly share code, notes, and snippets.

@millionsmile
Created August 4, 2012 10:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save millionsmile/3256617 to your computer and use it in GitHub Desktop.
Save millionsmile/3256617 to your computer and use it in GitHub Desktop.
Histogram in Python
# pythonでヒストグラム
# [データ]https://github.com/maksim2042/SNABook/tree/master/chapter1/egypt_retweets.net
# データファイルはpythonを実行しているフォルダーと同じ階層に置く
e=net.read_pajek("egypt_retweets.net")
len(e) # 25178
len(net.connected_component_subgraphs(e)) # 3122
import matplotlib.pyplot as plot
x=[len(c) for c in net.connected_component_subgraphs(e)]
plot.hist(x)
show()
# plot.hist(x, range(1,10))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment