Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
Edge-labeled/weighted graphs
There are useful definitions and algorithms in Data.Tree and Data.Graph but sadly these only deal with unlabeled graphs. Most definitions here mirror those in Data.Graph.
Documentation
LNode | |
|
Instances
Functor (LTree b) Source # | |
Foldable (LTree b) Source # | |
Defined in LabelledGraph fold :: Monoid m => LTree b m -> m # foldMap :: Monoid m => (a -> m) -> LTree b a -> m # foldMap' :: Monoid m => (a -> m) -> LTree b a -> m # foldr :: (a -> b0 -> b0) -> b0 -> LTree b a -> b0 # foldr' :: (a -> b0 -> b0) -> b0 -> LTree b a -> b0 # foldl :: (b0 -> a -> b0) -> b0 -> LTree b a -> b0 # foldl' :: (b0 -> a -> b0) -> b0 -> LTree b a -> b0 # foldr1 :: (a -> a -> a) -> LTree b a -> a # foldl1 :: (a -> a -> a) -> LTree b a -> a # elem :: Eq a => a -> LTree b a -> Bool # maximum :: Ord a => LTree b a -> a # minimum :: Ord a => LTree b a -> a # | |
Traversable (LTree b) Source # | |
(Eq a, Eq b) => Eq (LTree b a) Source # | |
(Show a, Show b) => Show (LTree b a) Source # | |
(NFData a, NFData b) => NFData (LTree b a) Source # | |
Defined in LabelledGraph |
buildLG :: Bounds -> [LEdge b] -> LGraph b Source #
Builds a LGraph from a list of LEdges. O(n + m) for bounds size n and m edges.
dfsLTree :: LGraph b -> Vertex -> LTree b Vertex Source #
For a LGraph that is known to be a tree, returns its LTree representation. O(n).
lTreeToTree :: LTree b a -> Tree a Source #
Drops labels from an LTree. O(n).