Note
This is the documentation for the current state of the development branch of rustworkx. The documentation or APIs here can change prior to being released.
rustworkx.generators.karate_club_graph#
- karate_club_graph(multigraph=True)#
Generates Zachary’s Karate Club graph.
Zachary’s Karate Club graph is a well-known social network that represents the relations between 34 members of a karate club, as described in the paper by Zachary [1].
The graph is undirected and contains 34 nodes (members) and 78 edges (interactions). Each node represents a club member, and each edge represents a relationship between two members.
- Parameters:
multigraph (bool) – When set to
False
, the outputPyGraph
object will not be not be a multigraph and won’t allow parallel edges to be added. Instead calls which would create a parallel edge will update the existing edge.- Returns:
The undirected graph representing the Karate club graph. Each node is labeled according to its assigned faction.
- Return type:
import rustworkx.generators from rustworkx.visualization import mpl_draw graph = rustworkx.generators.karate_club_graph() layout = rustworkx.circular_layout(graph) mpl_draw(graph, pos=layout)