This CLI tool can compute the matrix representation of the transitive closure of a finite binary relation. This tool is written in Haskell.
- matrix (Relation representation)
- vector
- optparse-applicative (CLI)
First and foremost, clone the repository on your local machine:
$ git clone https://github.com/junkidesu/learning-junkie-apiTo build the tool locally, ensure that the following are installed:
Stack and Cabal can be installed either independently or with the GHCup tool.
At the root of the repository, run
$ stack installTo ensure that the tool is installed, run
$ transitive-closures-exe --helpFinite binary relations can be represented with zero-one matrices. These matrices, in turn, can be represented programmatically as lists of lists. This CLI tool accepts such a representation as input. It can be supplied either directly to the executable, or with a text file.
$ transitive-closures-exe -m "[[1, 0, 1], [0, 1, 0], [1, 1, 0]]"
$ transitive-closures-exe -f matrix.txt
Contents of matrix.txt:
[
[1, 0, 1],
[0, 1, 0],
[1, 1, 0]
]
Naive algorithm is used by default. To use Warshall algorithm, provide the --warshall flag.