Kreher and Stinson Combinatorial Routines

COMBO is a Python library which includes routines for ranking, unranking, enumerating and randomly selecting balanced sequences, cycles, graphs, Gray codes, subsets, partitions, permutations, restricted growth functions, Pruefer codes and trees.

Routines are available to count, list, rank and unrank such objects

Some of these sets of objects can be ordered in several different ways, and in some cases, a separate set of ranking, unranking, and successor routines are available for the various orderings (lexical, colexical, revolving door, Trotter-Johnson).

Kreher and Stinson provide C source-code for the routines, as well as other information, at their web site.


The computer code and data files described and made available on this web page are distributed under the GNU LGPL license.


COMBO is available in a C version and a C++ version and a FORTRAN77 version and a FORTRAN90 version and a MATLAB version and a Python version.

Related Data and Programs:

MONOMIAL, a Python library which enumerates, lists, ranks, unranks and randomizes multivariate monomials in a space of M dimensions, with total degree less than N, equal to N, or lying within a given range.

PARTITION_PROBLEpy, a Python library which seeks solutions of the partition problem, splitting a set of integers into two subsets with equal sum.

POLYNOMIAL, a Python library which adds, multiplies, differentiates, evaluates and prints multivariate polynomials in a space of M dimensions.

SUBSET, a Python library which generates, ranks and unranks various combinatorial objects.

SUBSET_SUpy, a Python library which seeks solutions of the subset sum problem.

UNICYCLE, a Python library which considers permutations containing a single cycle, sometimes called cyclic permutations.

Source Code:

Examples and Tests:

You can go up one level to the Python source codes.

Last revised on 01 January 2016. <%-- John Burkardt -->