<commit_before>\begin{code}
module Digraph(

	-- At present the only one with a "nice" external interface
	stronglyConnComp, stronglyConnCompR, SCC(..), flattenSCC, flattenSCCs,

	Graph, Vertex, 
	graphFromEdges, graphFromEdges', 
	buildG, transposeG, reverseE, outdegree, indegree,

	Tree(..), Forest,
	showTree, showForest,

	dfs, dff,
	topSort,
	components,
	scc,
	back, cross, forward,
	reachable, path,
	bcc

    ) where

# include "HsVersions.h"

------------------------------------------------------------------------------
-- A version of the graph algorithms described in:
-- 
-- ``Lazy Depth-First Search and Linear Graph Algorithms in Haskell''
--   by <NAME> and <NAME>
-- 
-- Also included is some additional code for printing tree structures ...
------------------------------------------------------------------------------


import Util	( sortLe )

-- Extensions
import MONAD_ST

-- std interfaces
import Maybe
import Array
import List
import Outputable

#if __GLASGOW_HASKELL__ >= 504
import Data.Array.ST  hiding ( indices, bounds )
#else
import ST
#endif
\end{code}


%************************************************************************
%*									*
%*	External interface
%*									*
%************************************************************************

\begin{code}
data SCC vertex = AcyclicSCC vertex
	        | CyclicSCC  [vertex]

flattenSCCs :: [SCC a] -> [a]
flattenSCCs = concatMap flattenSCC

flattenSCC (AcyclicSCC v) = [v]
flattenSCC (CyclicSCC vs) = vs

instance Outputable a => Outputable (SCC a) where
   ppr (AcyclicSCC v) = text "NONREC" $$ (nest 3 (ppr v))
   ppr (CyclicSCC vs) = text "REC" $$ (nest 3 (vcat (map ppr vs)))
\end{code}

\begin{code}
stronglyConnComp
	:: Ord key<commit_msg>Fix Array imports<commit_after>\begin{code}
module Digraph(

	-- At present the only one with a "nice" external interface
	stronglyConnComp, stronglyConnCompR, SCC(..), flattenSCC, flattenSCCs,

	Graph, Vertex, 
	graphFromEdges, graphFromEdges', 
	buildG, transposeG, reverseE, outdegree, indegree,

	Tree(..), Forest,
	showTree, showForest,

	dfs, dff,
	topSort,
	components,
	scc,
	back, cross, forward,
	reachable, path,
	bcc

    ) where

# include "HsVersions.h"

------------------------------------------------------------------------------
-- A version of the graph algorithms described in:
-- 
-- ``Lazy Depth-First Search and Linear Graph Algorithms in Haskell''
--   by <NAME> and <NAME>
-- 
-- Also included is some additional code for printing tree structures ...
------------------------------------------------------------------------------


import Util	( sortLe )

-- Extensions
import MONAD_ST

-- std interfaces
import Maybe
import Array
import List
import Outputable

#if __GLASGOW_HASKELL__ > 604
import Data.Array.ST
#elif __GLASGOW_HASKELL__ >= 504
import Data.Array.ST  hiding ( indices, bounds )
#else
import ST
#endif
\end{code}


%************************************************************************
%*									*
%*	External interface
%*									*
%************************************************************************

\begin{code}
data SCC vertex = AcyclicSCC vertex
	        | CyclicSCC  [vertex]

flattenSCCs :: [SCC a] -> [a]
flattenSCCs = concatMap flattenSCC

flattenSCC (AcyclicSCC v) = [v]
flattenSCC (CyclicSCC vs) = vs

instance Outputable a => Outputable (SCC a) where
   ppr (AcyclicSCC v) = text "NONREC" $$ (nest 3 (ppr v))
   ppr (CyclicSCC vs) = text "REC" $$ (nest 3 (vcat (map ppr vs)))
\end{code}

\begin{code}
stronglyConnComp
	:: Ord key
{'fraction_non_alphanumeric': 0.2657976763955795, 'fraction_numerical': 0.0036837631056956645, 'mean_word_length': 2.7275607180570223, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 14, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7289071', 'n_tokens_mistral': 1180, 'n_tokens_neox': 1074, 'n_words': 330}