// -*- C++ -*-
// automatically generated by autodoc

// ========== HEADER FILE src/graph/digraph-paths.h: ==========

class digraph_paths;
// Find all full paths in a directed graph.

// ========== HEADER FILE src/graph/digraph.h: ==========

class digraph;
// Directed graph with ng nodes.
// Initialization just allocates memory,
//  filling in the edges is left to the user.

// ========== HEADER FILE src/graph/lyndon-gray.h: ==========

class lyndon_gray;
// Gray code for n-bit Lyndon words (for prime n), else (n odd composite)
//   Gray code for necklaces (except all-ones and all-zeros word).
// Must have: n odd, n<BITS_PER_LONG
// Needs (2^n-2)/4 bits = (2^n-2)/32 bytes of memory.

// ========== HEADER FILE src/graph/mk-special-digraphs.h: ==========

// Auxiliary routines for special graphs
// ----- SRCFILE=src/graph/mk-complete-digraph.cc: -----
digraph * make_complete_digraph(ulong n);
// Initialization for the complete graph.

// ----- SRCFILE=src/graph/mk-debruijn-digraph.cc: -----
digraph * make_debruijn_digraph(ulong n);

digraph * make_complement_shift_digraph(ulong n);

digraph * make_debruijn_digraph(ulong n, ulong m);
// m-ary version

// ----- SRCFILE=src/graph/mk-gray-digraph.cc: -----
digraph * make_gray_digraph(ulong n, bool rq/*=0*/);
// Initialization for directed graph:
// Gray code graph for n-bit words.

ulong start_monotonic_gray_path(digraph_paths &dp, ulong n);
// Let path start as (a canonical monotonic Gray path):
// Return number of positions marked.
// Example for 5 bits: (return==10)
// 0:  ..... 0  0
// 1:  ....1 1  1
// 2:  ...11 2  3
// 3:  ...1. 1  2
// 4:  ..11. 2  6
// 5:  ..1.. 1  4
// 6:  .11.. 2  12
// 7:  .1... 1  8
// 8:  11... 2  24
// 9:  1.... 1  16

// ----- SRCFILE=src/graph/mk-paren-gray-digraph.cc: -----
static bool parengray_is_neighbor(ulong fk, ulong fj, ulong pcd, ulong /*nb*/);

digraph * make_parengray_digraph(ulong nb, ulong pcd);

// ----- SRCFILE=src/graph/mk-fibrep-gray-digraph.cc: -----
digraph * make_fibrepgray_digraph(ulong n);

// ----- SRCFILE=src/graph/mk-mtl-digraph.cc: -----
digraph * make_mtl_digraph(ulong k, bool rq/*=0*/);
// Initialization for the "middle two levels" graph

// ----- SRCFILE=src/graph/mk-perm-gray-digraph.cc: -----
digraph * make_perm_gray_digraph(ulong n, bool stq);
// Initialization for directed graph:
// Gray code permutations of n elements
// with star transpositions if stq==true,
// otherwise with adjacent changes.

// ----- SRCFILE=src/graph/mk-perm-pref-rev-digraph.cc: -----
digraph * make_perm_pref_rev_digraph(ulong n);
// Initialization for directed graph:
// permutations are connected by prefix reversals

// ----- SRCFILE=src/graph/mk-perm-pref-rot-digraph.cc: -----
digraph * make_perm_pref_rot_digraph(ulong n, bool rq/*=0*/);
// Initialization for directed graph:
// permutations are connected by prefix rotations,
// rq = 1 ==> right rotations, otherwise left rotations.

class lyngray_dat;
// Data needed for Gray paths through Lyndon words.

// ----- SRCFILE=src/graph/mk-lyndon-gray-digraph.cc: -----
void print_lyndon_gray_digraph(const digraph &dg, lyngray_dat *ldat);
// Print Lyndon-Gray digraph.

bool lyndon_gray_rot_delta(const ulong *rv, ulong ng, lyngray_dat *ldat);
// Setup arrays with rotations (rr[]) and the delta sequence (dd[]).
// Return whether all rotations are zero.

void print_lyndon_gray_path(const digraph_paths &dp, lyngray_dat *ldat);
// Detailed print of path through Lyndon-Gray digraph.

digraph * make_lyndon_gray_digraph(ulong n, lyngray_dat *&ldat, ulong rot0q/*=0*/);
// Initialization for Lyndon-Gray digraph:
// n must be a prime <=BITS_PER_LONG.

// ----- SRCFILE=src/graph/lyndon-cmp.cc: -----
int lyndon_cmp0(const ulong &a, const ulong &b);

int lyndon_cmp1(const ulong &a, const ulong &b);

int lyndon_cmp2(const ulong &a, const ulong &b);

int lyndon_cmp3(const ulong &a, const ulong &b);

int lyndon_cmp4(const ulong &a, const ulong &b);

int lyndon_cmp5(const ulong &a, const ulong &b);

int lyndon_cmp6(const ulong &a, const ulong &b);

int lyndon_cmp7(const ulong &a, const ulong &b);

// ========== HEADER FILE src/graph/print-path.h: ==========

// ----- SRCFILE=src/graph/print-path.cc: -----
void print_path(const ulong *rv, ulong ng);
// Print sequence of nodes.
// Example: the first (De Bruijn) sequence for n=8 (ng=16) is
//  0 1 2 4 9 3 6 13 10 5 11 7 15 14 12 8

void print_bin_path(const ulong *rv, ulong ng, ulong ngbits);
// Print sequence of nodes both binary and decimal.
// Example: the first (De Bruijn) sequence for n=8 (ng=16) is:
// ....    0
// ...1    1
// ..1.    2
// .1..    4
// 1..1    9
// ..11    3
// .11.    6
// 11.1   13
// 1.1.   10
// .1.1    5
// 1.11   11
// .111    7
// 1111   15
// 111.   14
// 11..   12
// 1...    8

void print_bin_horiz_path(const ulong *rv, ulong ng, ulong ngbits, const char *c01/*=nullptr*/);
// Horizontally print sequence of nodes in binary.
// The first line corresponds to least significant bit.
// Example: the first (De Bruijn) sequence for n=8 (ng=16) is:

