plot_karate_club.py 494 B

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