Safe Haskell | Safe |
---|---|

Language | Haskell2010 |

Collects all functions pertaining to trees

- boolToInt :: Bool -> Int
- isLeaf :: Tree a -> Bool
- leaves :: Tree a -> [a]
- leavesHeight :: Ord a => Int -> Tree a -> Map a Int
- leavesCommonHeight :: Ord a => Int -> Tree a -> Map a (Int, Int)
- leavesParentMult :: Ord a => Double -> Double -> Tree a -> Map a (Double, Double)
- leavesCommonParentMult :: Ord a => Int -> Tree a -> Map a (Int, Int)
- leavesHeightList :: Int -> Tree a -> [(a, Int)]
- innerNodes :: Tree a -> [a]
- numLeaves :: Num b => Tree a -> b
- numInner :: Num b => Tree a -> b
- hasRootLeaf :: Tree a -> Bool
- getRootLeaves :: Tree a -> [a]
- getProperties :: Eq b => PropertyMap a b -> [b]
- filterLeaves :: Tree a -> Tree a
- filterRootLeaves :: Tree a -> Tree a
- getDistanceMap :: (Eq a, Ord a) => Tree a -> DistanceMap a
- getDistance :: Eq a => Tree a -> a -> a -> Int
- getDistanceMapSuperNode :: (Eq a, Ord a) => Tree (SuperNode a) -> DistanceMap a
- getDistanceSuperNode :: (Eq a, Ord a) => Tree (SuperNode a) -> a -> a -> Int
- sumTree :: Num a => Tree a -> a
- toSuperNodeTree :: Ord a => SuperNode a -> Tree a -> Tree (SuperNode a)

# Documentation

leavesHeight :: Ord a => Int -> Tree a -> Map a Int Source

Return the labels of the leaves of the tree with their relative heights from the root (the input number you give determines how many steps away the leaves are, should almost always start at 0)

leavesCommonHeight :: Ord a => Int -> Tree a -> Map a (Int, Int) Source

Return the labels of the leaves of the tree with their relative heights from the root (the input number you give determines how many steps away the leaves are, should almost always start at 0). Also, here we give leaves that share a parent a separate label.

leavesParentMult :: Ord a => Double -> Double -> Tree a -> Map a (Double, Double) Source

Return the labels of the leaves of the tree with their weights determined by the product of the number of children of their parents all the way up to the root, along with their distance. Returns Double for more precision.

leavesCommonParentMult :: Ord a => Int -> Tree a -> Map a (Int, Int) Source

Return the labels of the leaves of the tree with their weights determined by the product of the number of children of their parents all the way up to the root. Also, here we give leaves that share a parent a separate label.

leavesHeightList :: Int -> Tree a -> [(a, Int)] Source

Return the labels of the leaves of the tree with their relative heights from the root (the input number you give determines how many steps away the leaves are, should almost always start at 0), slower version not requiring Ord but no Maps

innerNodes :: Tree a -> [a] Source

Return the inner nodes of the tree

hasRootLeaf :: Tree a -> Bool Source

Return True if a tree has a leaf connected to the root of the given tree

getRootLeaves :: Tree a -> [a] Source

Return the list of root leaves

getProperties :: Eq b => PropertyMap a b -> [b] Source

Return the list of properties in a property map for a tree

filterLeaves :: Tree a -> Tree a Source

Remove leaves from a tree

filterRootLeaves :: Tree a -> Tree a Source

Remove leaves attached to the root of the tree

getDistanceMap :: (Eq a, Ord a) => Tree a -> DistanceMap a Source

Return the map of distances from each leaf to another leaf

getDistance :: Eq a => Tree a -> a -> a -> Int Source

Find the distance between two leaves in a tree.

getDistanceMapSuperNode :: (Eq a, Ord a) => Tree (SuperNode a) -> DistanceMap a Source

Return the map of distances from each leaf to another leaf