Copyright | (c) Immanuel Albrecht 2020-202x |
---|---|
License | BSD-3 |
Maintainer | mail@immanuel-albrecht.de |
Stability | experimental |
Portability | POSIX |
Safe Haskell | Safe-Inferred |
Language | Haskell2010 |
This module provides internal helpers used by the graphic matroid module.
Although it is exported, using anything from this module that is not re-exported by another module may (and eventually will) break client side code. The main reason for exporting this is so anyone can inspect internals using haddock; it's a little bit like an open door policy for code.
Documentation
data type to keep track of forrests in a (multi-)graph
Instances
(Eq v, Eq a) => Eq (Forrest v a) Source # | |
(Ord v, Ord a) => Ord (Forrest v a) Source # | |
Defined in Data.Matroid.Graphic.Internal | |
(Show v, Show a) => Show (Forrest v a) Source # | |
emptyForrest :: Forrest v a Source #
obtain an empty forrest
insertEdgeOrGetCycleComponent Source #
:: (Ord v, Ord a) | |
=> Forrest v a | forrest to insert into / find the cycle |
-> a | name of the edge |
-> (v, v) | incidence tuple of the edge; |
-> Either (Set a) (Forrest v a) |
Takes a forrest and tries to add another edge to it.
If possible (Right
), then it returns the forrest with the edge added
otherwise (Left
) returns the component with a cycle after adding e
.
Please note that for a result Left x
, the set x
contains a cycle, but it
is not necessarily a cycle itself. (It's a cycle with trees on it)