Defined in <stapl/containers/graph/generators/lollipop.hpp>

template<typename GraphView>  
GraphView make_lollipop(size_t m,size_t n,bool bidirectional)


Generate a lollipop graph.

This is the barbell graph without the right barbell.

For and , the complete graph is connected to the path . The resulting nodes are labelled for the complete graph and for the path. The 2 subgraphs are joined via the edge . If , this is merely a complete graph.

Node labels are the integers 0 to m+n-1.

This function mutates the input graph.

This graph is an extremal example in David Aldous and Jim Fill's etext on Random Walks on Graphs. 1


  • m: The number of nodes in the complete subgraph.
  • n: The number of nodes in the chain.
  • bidirectional: True for adding back-edges, False for forward only.


A view over the generated graph.

The returned view owns its underlying container.


  using view_type = stapl::graph_view<stapl::multidigraph<int>>;

  auto v = stapl::generators::make_lollipop<view_type>(16, 1024);

1 Aldous, David and Fill, James Allen. "Reversible Markov Chains and Random Walks on Graphs," 2002.

results matching ""

    No results matching ""