-- Hoogle documentation, generated by Haddock
-- See Hoogle, http://www.haskell.org/hoogle/


-- | Calculate the clumpiness of leaf properties in a tree
--   
--   Calculate the clumpiness of leaf properties in a tree
@package clumpiness
@version 0.17.0.0


-- | Collects all types used in the program
module Math.Clumpiness.Types
data Pinpoint a b
Pinpoint :: a -> Seq (b, b, Double) -> Seq a -> Pinpoint a b
[pinpointLabel] :: Pinpoint a b -> a
[pinpointClumpiness] :: Pinpoint a b -> Seq (b, b, Double)
[pinpointLeaves] :: Pinpoint a b -> Seq a
type ClumpList a = [(a, a, Double)]

module Math.Clumpiness.Algorithms

-- | Get the geometric average of a list
geomAvg :: [Double] -> Double

-- | Weigh the nodes by what weight they have (based on the product of the
--   number of children their parents have, see leavesParentMult in
--   tree-fun) and invert it
weigh :: Double -> Double

-- | Only look at these properties, if they aren't both in the list (or if
--   p1 == p2 and the length is 1), then ignore it
relevantList :: (Eq a) => a -> a -> [(a, Int)] -> [Int]

-- | Only look at these properties, if they aren't both in the list (or if
--   p1 == p2 and the length is 1), then ignore it, Map version. Ignore
--   nodes not in propertyMap
relevantMap :: (Ord a, Ord b) => b -> b -> PropertyMap a b -> Map a c -> Map a c

-- | Only look at these properties, if they aren't both in the list (or if
--   p1 == p2 and the length is 1 meaning that there is no other leaf of
--   any other type), then ignore it. Ignore nodes not in propertyMap
relevantMapSame :: (Ord a, Ord b) => b -> PropertyMap a b -> Map a c -> Map a c

-- | Get the clumpiness of a single node. Ignore the root node. Only count
--   p1 == p2 case when there are at least one set of neighboring leaves in
--   order to account for the extreme cases (complete mixture, complete
--   separation of properties) which are throwing off the p1 == p2 case. So
--   explicitly calculate cases where the number of descendent leaves is 2.
--   Ignore nodes not in propertyMap
getNodeClumpiness :: (Ord a, Ord b) => b -> b -> PropertyMap a b -> Tree (SuperNode a) -> Double

-- | Get the clumpiness metric (before sample size correction)
getPropertyClumpiness :: (Ord a, Ord b) => b -> b -> PropertyMap a b -> Tree (SuperNode a) -> Double

-- | Get the heatmap for the clumping metric, how "clumped together" the
--   properties are. Found by counting the parents whose descendent leaves
--   are of those properties. They are weighted by how far away those
--   leaves are. Remove any unwanted properties by having the "viable"
--   function take in a property and return if it is viable or not. The
--   PropertyMap should have all of the vertices within the tree but no
--   more --- any additional and the clumpiness changes as the sample sizes
--   change --- so this property has not been tested and so it may lead to
--   new ways of viewing clumpiness.
generateClumpMap :: (Ord a, Ord b) => (b -> Bool) -> PropertyMap a b -> Tree (SuperNode a) -> ClumpList b

module Math.Clumpiness.Utilities

-- | Get the third element of a triple tuple
thd' :: (a, b, c) -> c

module Math.Clumpiness.Pinpoint

-- | Filter the PropertyMap based on the tree, getting rid of extra
--   vertices
getValidPropertyMap :: (Ord a, Ord b) => Tree (SuperNode a) -> PropertyMap a b -> PropertyMap a b

-- | Convert a subtree first node to a root
rootSubtree :: Tree (SuperNode a) -> Tree (SuperNode a)

-- | Check if a node belongs to a label
viableNode :: (Ord a, Ord b) => (b -> Bool) -> PropertyMap a b -> a -> Bool

-- | Assign the clumpiness to each subtree and add them to a list. Ignore
--   if the vertex is a root
pinpointRecursion :: (Ord a, Ord b) => (b -> Bool) -> PropertyMap a b -> Tree (SuperNode a) -> Seq (Pinpoint a b)

-- | Return the clumpiness vertices in the tree based on the minimum
--   clumpiness and the minimum number of descendent leaves. Here, viable
--   is the same usage as in Algorithms. The clumpiness values are only
--   reported if they are above a threshold of minClumpiness.
pinpoint :: (Ord a, Ord b) => Double -> Int -> (b -> Bool) -> PropertyMap a b -> Tree (SuperNode a) -> Seq (Pinpoint a b)
