Liking cljdoc? Tell your friends :D

tarantella.core


(dancing-links m & {:keys [limit timeout lazy select-rows] :as options})

Can take input in one of three formats:

  • A matrix (vector of equal-length vectors) of 1s and 0s
  • A map of the form {row-label set-of-column-labels, ...}
  • A sequential collection of the form [set-of-column-labels-for-row-0 ...]

Returns a vector of all the solutions (each solution is a vector of row labels, where the rows are implicitly labeled 0,1,... if no labels are specified).

Optional keywords: :optional-columns - A set of column labels where at most one 1 can be in that column (as opposed to exactly one 1 like the standard columns) :forbid-columns - A set of column labels where no 1 can be in that column (as opposed to exactly one 1 like the standard columns) :select-rows - A set of row labels that must be selected for the solution :shuffle - Boolean. Randomize search among equally promising alternatives

:lazy - Boolean. Return a lazy sequence

:limit - A positive integer, stop early as soon as you find this many solutions :timeout - A number of milliseconds, stop early when this time has elapsed

:limit and :timeout are ignored if you have selected :lazy true. If :limit or :timeout is specified, metadata will be attached to the return vector of the form {:search-ended-due-to-limit true/false, :search-ended-due-to-timeout true/false}

Can take input in one of three formats:
 - A matrix (vector of equal-length vectors) of 1s and 0s
 - A map of the form {row-label set-of-column-labels, ...}
 - A sequential collection of the form [set-of-column-labels-for-row-0 ...]

Returns a vector of all the solutions (each solution is a vector of row labels,
where the rows are implicitly labeled 0,1,... if no labels are specified).

Optional keywords:
 :optional-columns - A set of column labels where *at most one* 1 can be in that column
                     (as opposed to *exactly one* 1 like the standard columns)
 :forbid-columns   - A set of column labels where *no* 1 can be in that column
                     (as opposed to *exactly one* 1 like the standard columns)
 :select-rows      - A set of row labels that must be selected for the solution
 :shuffle          - Boolean. Randomize search among equally promising alternatives

 :lazy             - Boolean. Return a lazy sequence

 :limit            - A positive integer, stop early as soon as you find this many solutions
 :timeout          - A number of milliseconds, stop early when this time has elapsed

:limit and :timeout are ignored if you have selected `:lazy true`.
If :limit or :timeout is specified, metadata will be attached to the return vector of the form
{:search-ended-due-to-limit true/false, :search-ended-due-to-timeout true/false}
sourceraw docstring

dancing-links supports three input formats. See specs for: :tarantella.core/matrix :tarantella.core/row-map :tarantella.core/row-seq

dancing-links supports three input formats. See specs for:
:tarantella.core/matrix
:tarantella.core/row-map
:tarantella.core/row-seq
sourceraw docstring

cljdoc is a website building & hosting documentation for Clojure/Script libraries

× close