Copyright | (c) Dominik Schrempf 2019 |
---|---|
License | GPL-3 |
Maintainer | dominik.schrempf@gmail.com |
Stability | unstable |
Portability | portable |
Safe Haskell | None |
Language | Haskell2010 |
Creation date: Fri Aug 30 15:28:17 2019.
Bipartition
s are weird in that
> Bipartition x y == Bipartition y x
is True.
Also,
> Bipartition x y > Bipartition y x
is False, even when x > y
.
That's why we have to make sure that for
> Bipartition x y
we always have x >= y
.
Synopsis
- data Bipartition a
- bp :: Ord a => Set a -> Set a -> Bipartition a
- bpmap :: (Ord a, Ord b) => (a -> b) -> Bipartition a -> Bipartition b
- bipartitions :: Ord a => Tree a -> Set (Bipartition a)
- bipartitionToBranch :: (Ord a, Ord b, Monoid c) => (a -> b) -> (a -> c) -> Tree a -> Map (Bipartition b) c
- bipartitionsCombined :: (Ord a, Show a) => Tree a -> Set (Bipartition a)
The Bipartition
data type.
data Bipartition a Source #
Bipartitions with Set
s, since order of elements within the leaf sets
is not important. Also the order of the two leaf sets of the bipartition is
not important (see Eq
instance definition).
Instances
bpmap :: (Ord a, Ord b) => (a -> b) -> Bipartition a -> Bipartition b Source #
Map a function over all elements in the Bipartition
s.
Working with Bipartition
s.
bipartitions :: Ord a => Tree a -> Set (Bipartition a) Source #
Get all bipartitions.
:: (Ord a, Ord b, Monoid c) | |
=> (a -> b) | Value to compare on |
-> (a -> c) | Convert node to branch length |
-> Tree a | Tree to dissect |
-> Map (Bipartition b) c |
Each branch on a Tree
defines a unique Bipartition
of leaves. Convert a
tree into a Map
from each Bipartition
to the branch inducing the
respective Bipartition
. The information about the branch is extracted from
the nodes with a given function. If the tree has degree two nodes, the branch
values are combined; a unity element is required, and so we need the Monoid
type class constraint. Checks if leaves are unique.
bipartitionsCombined :: (Ord a, Show a) => Tree a -> Set (Bipartition a) Source #
Get all bipartitions, but combine leaves from multifurcations. This is
useful to find incompatible splits. See
incompatibleSplitsDistance
. Assume that a root
node with three children is actually not a multifurcation (because then we
would have no induced bypartitions), but rather corresponds to an unrooted
tree.