lollipop_graph#
- lollipop_graph(m, n, create_using=None)[source]#
Returns the Lollipop Graph;
K_m
connected toP_n
.This is the Barbell Graph without the right barbell.
(
Source code
,png
)- Parameters:
- m, nint or iterable container of nodes
If an integer, nodes are from
range(m)
andrange(m, m+n)
. If a container of nodes, those nodes appear in the graph. Warning:m
andn
are not checked for duplicates and if present the resulting graph may not be as desired. Make sure you have no duplicates.The nodes for
m
appear in the complete graph \(K_m\) and the nodes forn
appear in the path \(P_n\)- create_usingNetworkX graph constructor, optional (default=nx.Graph)
Graph type to create. If graph instance, then cleared before populated.
- Returns:
- Networkx graph
A complete graph with
m
nodes connected to a path of lengthn
.
Notes
The 2 subgraphs are joined via an edge
(m-1, m)
. Ifn=0
, this is merely a complete graph.(This graph is an extremal example in David Aldous and Jim Fill’s etext on Random Walks on Graphs.)
Additional backends implement this function
cugraph : GPU-accelerated backend.