Safe Haskell | Safe-Infered |
---|

# Documentation

type Complex = Vector ([Int], [Int], Bool)Source

A complex is a vector of triples. Each index represents a generator, $x$, and the triple refers $(dx, d^{-1}x, alive?)$, where $dx$ is the list of generators that $x$ maps to, $d^{-1}x$ is the list of generators $y$ such that $x in dy$, and alive? indicates whether x is still an element of the complex (alive? = true by default).

`>>>`

IV.fromList [([], [3], True), ([], [3], True), ([], [], True), ([0, 1, 2], [], True), ([], [3], True)]`example1`

homology :: Complex -> HomologySource

Compute the homology of a complex by the following method: Represent the complex by a directed graph, where the vertex set is the set of generators, and there is an edge from x to y if $y in dx$. For each $x$ such that $dx neq emptyset$, pick $y in dx$. For each $z in d^{-1}y$, and $w in dx$, if there is an edge from $z$ to $w$, delete it, otherwise create an edge from $z$ to $w$. Finally, delete $x$, $y$, and all edges into and out of $x$ and $y$. Continue iterating this process until there are no edges left, then read off the homology (the list of elements that are still alive in the complex).

`>>>`

[1,2,4]`homology example1`

`>>>`

[2,3,4,5]`homology example2`

An example complex.

`>>>`

IV.fromList [([], [3], True), ([], [3], True), ([], [], True), ([0, 1, 2], [], True), ([], [3], True)]`example1`