networkx.generators.classic.lollipop_graph¶
-
lollipop_graph
(m, n, create_using=None)[source]¶ Return the Lollipop Graph;
K_m
connected toP_n
.This is the Barbell Graph without the right barbell.
Parameters: m, n (int or iterable container of nodes (default = 0)) – If an integer, nodes are from
range(m)
andrange(m,m+n)
. If a container, the entries are the coordinate of the node.The nodes for m appear in the complete graph \(K_m\) and the nodes for n appear in the path \(P_n\)
create_using (Graph, optional (default Graph())) – If provided this graph is cleared of nodes and edges and filled with the new graph. Usually used to set the type of the graph.
Notes
The 2 subgraphs are joined via an edge (m-1, m). If n=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.)