[project @ 2003-11-06 12:50:22 by ross]
authorross <unknown>
Thu, 6 Nov 2003 12:50:24 +0000 (12:50 +0000)
committerross <unknown>
Thu, 6 Nov 2003 12:50:24 +0000 (12:50 +0000)
import Prelude if haddocking

Data/FiniteMap.hs
Data/Graph.hs
Data/Tree.hs

index f1db267..0b29bb3 100644 (file)
@@ -89,6 +89,10 @@ import Data.Maybe ( isJust )
 import GHC.Base
 #endif
 
+#ifdef __HADDOCK__
+import Prelude
+#endif
+
 #ifdef COMPILING_GHC
 IMP_Ubiq(){-uitous-}
 # ifdef DEBUG
index 12b3a01..4205964 100644 (file)
@@ -43,7 +43,7 @@ module Data.Graph(
        components,
        scc,
        bcc,
-       -- back, cross, forward,
+       -- tree, back, cross, forward,
        reachable, path,
 
        module Data.Tree
@@ -60,6 +60,10 @@ import Data.Maybe
 import Data.Array
 import Data.List
 
+#ifdef __HADDOCK__
+import Prelude
+#endif
+
 -------------------------------------------------------------------------
 --                                                                     -
 --     External interface
@@ -321,6 +325,10 @@ scc g = dfs g (reverse (postOrd (transposeG g)))
 -- 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 ]
index 8524935..2ba7b1a 100644 (file)
@@ -18,6 +18,10 @@ module Data.Tree(
        flatten, levels,
     ) where
 
+#ifdef __HADDOCK__
+import Prelude
+#endif
+
 -- | Multi-way trees, also known as /rose trees/.
 data Tree a   = Node a (Forest a) -- ^ a value and zero or more child trees.
 #ifndef __HADDOCK__