Home

Awesome

frontier_basic_tdzdd

An example implementation of the frontier-based search using TdZdd (https://github.com/kunisura/TdZdd ).

This program constructs a ZDD representing all the single cycles and a ZDD representing all the s-t paths on a given graph.

Usage

make
./program --cycle --show grid3x3.txt

You will get the following:

Reading "grid3x3.txt" ... done in 0.00s elapsed, 0.00s user, 4MB.
# of vertices = 9
# of edges = 12
FrontierExampleSpec .......... <53> in 0.00s elapsed, 0.00s user, 4MB.
# of ZDD nodes = 53
# of solutions = 13

This constructs a ZDD representing all the single cycles. If we specify an argument without '--', it is interpreted as the input graph filename, which is in an edge list format. The first edge (the first line in the file) corresponds to the variable (label) of the root of the constructed ZDD. See the document in English or Japanese for detail.

If you run

./program --path --show grid3x3.txt

You will get a ZDD representing all the s-t paths.

The frontier-based search for single cycles is implemented in the FrontierSingleCycleSpec class (as a "spec" of TdZdd), and that for s-t paths is implemeneted in the FrontierSTPathSpec class.

If you run the program without arguments like

./program

it runs for n x n grid for n = 2,...,10, and you will get the following:

n = 2, # of solutions = 1
n = 3, # of solutions = 13
n = 4, # of solutions = 213
n = 5, # of solutions = 9349
n = 6, # of solutions = 1222363
n = 7, # of solutions = 487150371
n = 8, # of solutions = 603841648931
n = 9, # of solutions = 2318527339461265
n = 10, # of solutions = 27359264067916806101

This implementation uses the Graph class in the TdZdd library. See the document in English or Japanese.

Options

General options

OptionEffect
--showShow information and error messages.
--dotOutput the constructed ZDD in the graphviz dot format.
--show-fsShow the frontiers of the input graph.
--enumEnumerate all the subgraphs.

Graph types

OptionGraph
--paths-t paths
--hampathHamiltonian s-t paths
--cycleCycles
--letter_OO-shaped graphs (equivalent to cycles)
--hamcycleHamiltonian cycles
--path_ms-t Paths (using mate)
--hampath_ms-t Hamiltonian paths (using mate)
--cycle_mCycles (using mate)
--hamcycle_mHamiltonian paths (using mate)
--forestForests
--treeTrees
--streeSpanning trees
--matchingMachings
--cmatchingComplete matchings
--letter_II-shaped graphs (equivalent to paths)
--letter_LL-shaped graphs (equivalent to paths)
--letter_PP-shaped graphs

Vertices s and t of (Hamiltonian) paths are fixed to be 1 and n (the number of vertices), respectively.

License

MIT License