barbell_graph#
- barbell_graph(m1, m2, create_using=None)[source]#
Returns the Barbell Graph: two complete graphs connected by a path.
- Parameters:
- m1int
Size of the left and right barbells, must be greater than 2.
- m2int
Length of the path connecting the barbells.
- create_usingNetworkX graph constructor, optional (default=nx.Graph)
Graph type to create. If graph instance, then cleared before populated. Only undirected Graphs are supported.
- Returns:
- GNetworkX graph
A barbell graph.
Notes
Two identical complete graphs \(K_{m1}\) form the left and right bells, and are connected by a path \(P_{m2}\).
- The
2*m1+m2
nodes are numbered 0, ..., m1-1
for the left barbell,m1, ..., m1+m2-1
for the path, andm1+m2, ..., 2*m1+m2-1
for the right barbell.
The 3 subgraphs are joined via the edges
(m1-1, m1)
and(m1+m2-1, m1+m2)
. Ifm2=0
, this is merely two complete graphs joined together.This graph is an extremal example in David Aldous and Jim Fill’s e-text on Random Walks on Graphs.