Warning

This documents an unmaintained version of NetworkX. Please upgrade to a maintained version and see the current NetworkX documentation.

networkx.generators.social.karate_club_graph

karate_club_graph()[source]

Returns Zachary’s Karate Club graph.

Each node in the returned graph has a node attribute ‘club’ that indicates the name of the club to which the member represented by that node belongs, either ‘Mr. Hi’ or ‘Officer’.

Examples

To get the name of the club to which a node belongs:

>>> import networkx as nx
>>> G = nx.karate_club_graph()
>>> G.nodes[5]['club']
'Mr. Hi'
>>> G.nodes[9]['club']
'Officer'

References

1

Zachary, Wayne W. “An Information Flow Model for Conflict and Fission in Small Groups.” Journal of Anthropological Research, 33, 452–473, (1977).

2

Data file from: http://vlado.fmf.uni-lj.si/pub/networks/data/Ucinet/UciData.htm