combo, an Octave code 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 MIT license


combo is available in a C version and a C++ version and a Fortran90 version and a MATLAB version and an Octave version and a Python version.

Related Data and Programs:


floyd, a MATLAB code which implements floyd's algorithm for finding the shortest distance between pairs of nodes on a directed graph.

subset, a MATLAB code which generates, ranks and unranks various combinatorial objects.


  1. Donald Kreher, Douglas Simpson,
    Combinatorial Algorithms,
    CRC Press, 1998,
    ISBN: 0-8493-3988-X,
    LC: QA164.K73.

Source Code:

Last revised on 11 September 2022. <%-- John Burkardt -->