https://github.com/sebtee/how-monochromatic
https://github.com/sebtee/how-monochromatic
graph-theory haskell
Last synced: 8 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/sebtee/how-monochromatic
- Owner: SebTee
- License: mit
- Created: 2021-12-27T22:19:42.000Z (over 4 years ago)
- Default Branch: main
- Last Pushed: 2022-07-11T22:34:53.000Z (almost 4 years ago)
- Last Synced: 2025-01-20T21:11:47.630Z (over 1 year ago)
- Topics: graph-theory, haskell
- Language: Haskell
- Homepage: https://sebtee.github.io/how-monochromatic/
- Size: 5.99 MB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: ChangeLog.md
- License: LICENSE
- Citation: CITATION.cff
Awesome Lists containing this project
README
# how-monochromatic
[](https://github.com/SebTee/how-monochromatic/actions/workflows/haskell.yml)
A tool to analyse [bi-coloured graphs](https://mariokrenn.wordpress.com/graph-theory-question/) and determine how close to being monochromatic they are.
[Documentation](https://sebtee.github.io/how-monochromatic/)
## Installation Guide
You need to have the [Haskell Tool Stack](https://haskellstack.org) installed.
Run the following commands:
```bash
git clone https://github.com/SebTee/how-monochromatic.git
cd ./how-monochromatic
stack install
```
## User Guide
The installed executable can be run by running `howmono` on the command line.
It takes no command line arguments.
It only reads a string encoded bi-coloured graph from the stdin.
The string encoding of the bi-coloured graph is defined in the
[ParseBCG documentation](https://sebtee.github.io/how-monochromatic/how-monochromatic-0.1.0.0/ParseBCG.html#v:parse)
(See the example `g.txt` file below).
The program will return a value between 0 and 1.
The closer to 1 the returned value is the closer to being monochromatic the input bi-coloured graph is.
### Example Command
The following command reads the bi-coloured graph from the `g.txt` file and
pipes it into the stdin of the `howmono` executable.
```bash
cat ./g.txt | howmono
```
Contents of `g.txt`
```
1 green 2 green 1 0
1 blue 3 blue 1 0
1 red 4 green 0 1
1 red 6 red 1 0
2 red 3 red 1 0
2 blue 5 blue 1 0
3 green 4 green 1 0
3 green 6 red 0 1
4 red 5 red 1 0
4 red 6 green 0 1
4 blue 6 blue 1 0
5 green 6 green 1 0
```
This example will return `0.5`.