plot_karate_club.py 529 B

123456789101112131415161718192021222324252627
  1. #!/usr/bin/env python
  2. """
  3. ===========
  4. Karate Club
  5. ===========
  6. Zachary's Karate Club graph
  7. Data file from:
  8. http://vlado.fmf.uni-lj.si/pub/networks/data/Ucinet/UciData.htm
  9. Reference:
  10. Zachary W. (1977).
  11. An information flow model for conflict and fission in small groups.
  12. Journal of Anthropological Research, 33, 452-473.
  13. """
  14. import matplotlib.pyplot as plt
  15. import networkx as nx
  16. G = nx.karate_club_graph()
  17. print("Node Degree")
  18. for v in G:
  19. print('%s %s' % (v, G.degree(v)))
  20. nx.draw_circular(G, with_labels=True)
  21. plt.show()