Copyright | 2022 Dominik Schrempf |
---|---|
License | GPL-3.0-or-later |
Maintainer | dominik.schrempf@gmail.com |
Stability | experimental |
Portability | portable |
Safe Haskell | Safe-Inferred |
Language | Haskell2010 |
Creation date: Wed Jun 29 15:57:09 2022.
Specify nodes using most recent common ancestors (MRCA).
Synopsis
- isAncestor :: Ord a => Set a -> Tree e a -> Bool
- isMrca :: Ord a => Set a -> Tree e a -> Bool
- getPathToMrca :: (Ord a, Show a) => Set a -> Tree e a -> Either String Path
- getTreeAtMrca :: (Ord a, Show a) => Set a -> Tree e a -> Either String (Tree e a)
- findNode :: (Ord a, Show a) => a -> Tree e a -> Either String (Set a)
Documentation
isAncestor :: Ord a => Set a -> Tree e a -> Bool Source #
Test if the root node of the given tree is an ancestor of the given leaves.
isMrca :: Ord a => Set a -> Tree e a -> Bool Source #
Test if the root node of the given tree is the MRCA of the given leaves.
getPathToMrca :: (Ord a, Show a) => Set a -> Tree e a -> Either String Path Source #
Get the path to the MRCA of the given leaves on the given tree.
Return Left
if:
- The tree has duplicate leaves.
- The MRCA cannot be found.
findNode :: (Ord a, Show a) => a -> Tree e a -> Either String (Set a) Source #
Find a node on a tree.
If the node is found, the node is specified by the MRCA of the returned set of leaves. The set will contain one element if the node is a leaf, or two elements, if the node is internal.
Return Left
if:
- The tree has duplicate labels.
- The node cannot be found.
- The node is a degree two node.