Skip to content

Instantly share code, notes, and snippets.

@brainstorm
Last active December 14, 2015 00:39
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 brainstorm/5000205 to your computer and use it in GitHub Desktop.
Save brainstorm/5000205 to your computer and use it in GitHub Desktop.
NetworkX rich gets richer algorithm
#!/usr/bin/env python
# http://rt.com/news/oxfam-report-global-inequality-357/
# http://networkx.github.com/documentation/latest/reference/generated/networkx.generators.random_graphs.barabasi_albert_graph.html
import networkx as nx
import matplotlib.pyplot as plt
g = nx.Graph()
ba = nx.barabasi_albert_graph(15, 5)
er = nx.erdos_renyi_graph(15, 0.15)
nx.draw(ba)
plt.savefig("barabasi.png")
nx.draw(er)
plt.savefig("erdos.png")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment