Warning

This documents an unmaintained version of NetworkX. Please upgrade to a maintained version and see the current NetworkX documentation.

lollipop_graph

lollipop_graph(m, n, create_using=None)[source]

Return the Lollipop Graph; \(K_m\) connected to \(P_n\).

This is the Barbell Graph without the right barbell.

For m>1 and n>=0, the complete graph K_m is connected to the path P_n. The resulting m+n nodes are labelled 0,…,m-1 for the complete graph and m,…,m+n-1 for the path. The 2 subgraphs are joined via the edge (m-1,m). If n=0, this is merely a complete graph.

Node labels are the integers 0 to number_of_nodes - 1.

(This graph is an extremal example in David Aldous and Jim Fill’s etext on Random Walks on Graphs.)