EcGen 1.1.8
Loading...
Searching...
No Matches
set_bipart.hpp File Reference

Set bipartition (2-block partition) generation. More...

#include <py2cpp/recursive_gen.hpp>
#include <type_traits>
Include dependency graph for set_bipart.hpp:

Go to the source code of this file.

Namespaces

namespace  ecgen

Functions

template<int N>
constexpr auto ecgen::Stirling2nd2 ()
 Compute Stirling numbers of the second kind S(N,2).
auto ecgen::set_bipart_gen (int n) -> py::RecursiveGenerator< int >

Detailed Description

Set bipartition (2-block partition) generation.

A bipartition of the set [n] = {1,2,3,...,n} into two nonempty blocks. This is a specialized case of set partitions with exactly 2 blocks.

The generator yields element indices that should be moved from one block to the other, following a Gray code ordering where successive partitions differ by moving only one element.

Reference: Frank Ruskey. Simple combinatorial Gray codes constructed by reversing sublists. Lecture Notes in Computer Science, #762, 201-208. Also downloadable from http://webhome.cs.uvic.ca/~ruskey/Publications/SimpleGray/SimpleGray.html