components,
scc,
bcc,
- -- back, cross, forward,
+ -- tree, back, cross, forward,
reachable, path,
module Data.Tree
import Data.Array
import Data.List
+#ifdef __HADDOCK__
+import Prelude
+#endif
+
-------------------------------------------------------------------------
-- -
-- External interface
-- | The strongly connected components of a directed graph, topologically
-- sorted. The function is the same as 'stronglyConnComp', except that
-- all the information about each node retained.
--- The "R" interface is used when you expect to apply 'SCC' to
+-- This interface is used when you expect to apply 'SCC' to
-- (some of) the result of 'SCC', so you don't want to lose the
-- dependency information.
stronglyConnCompR
-- Algorithm 5: Classifying edges
------------------------------------------------------------
+tree :: Bounds -> Forest Vertex -> Graph
+tree bnds ts = buildG bnds (concat (map flat ts))
+ where flat (Node v ts) = [ (v, w) | Node w _us <- ts ] ++ concat (map flat ts)
+
back :: Graph -> Table Int -> Graph
back g post = mapT select g
where select v ws = [ w | w <- ws, post!v < post!w ]