graphscope.nx.generators.social.karate_club_graph

graphscope.nx.generators.social.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’. Each edge has a weight based on the number of contexts in which that edge’s incident node members interacted.

Examples

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

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

References