packages feed

graphs

A simple monadic graph library

view on Hackage

A \"not-very-Haskelly\" API for calculating traversals of graphs that may be too large to fit into memory. The algorithms included are inspired by the visitor concept of the <http://www.boost.org/doc/libs/1_57_0/libs/graph/doc/visitor_concepts.html Boost Graph Library>. Here is a very simple example of how we might execute a depth-first-search. In this case the visitor simply collects the edges and vertices in the order that the corresponding functions get called. After the necessary imports, > import Data.Array > import Data.Monoid > import Data.Graph.AdjacencyList > import Data.Graph.Algorithm > import Data.Graph.Algorithm.DepthFirstSearch create an adjacency list where the vertices are labeled with integers. > graph :: Array Int [Int] > graph = array (0, 3) [(0, [1,2]), (1, [3]), (2, [3]), (3, [])] <<http://i.imgur.com/Pod1SH0.png>> We need a data structure that instantiates `Monoid` to combine the results of our visitor functions. @ data Orderings = Orderings &#32;&#32;&#123;&#32;&#32;enterV :: [Int] &#32;&#32;, enterE :: [(Int, Int)] &#32;&#32;, gray :: [(Int, Int)] &#32;&#32;, exitV :: [Int] &#32;&#32;, black :: [(Int, Int)] &#32;&#32;&#125;&#32;deriving Show instance Monoid Orderings where &#32;mempty = Orderings [] [] [] [] [] &#32;mappend (Orderings a1 a2 a3 a4 a5)(Orderings b1 b2 b3 b4 b5) = &#32;&#32;Orderings (a1 ++ b1) (a2 ++ b2) (a3 ++ b3) (a4 ++ b4) (a5 ++ b5) @ The `dfs` function's first argument is of type `GraphSearch` which is a visitor containing the functions to be run at various times during the search. The second argument is the starting vertex for the search. @ orderings :: GraphSearch (AdjacencyList Int) Orderings orderings = GraphSearch &#32;&#32;(\\v -> return $ mempty &#123;enterV = [v]&#125;) &#32;&#32;(\\e -> return $ mempty &#123;enterE = [e]&#125;) &#32;&#32;(\\e -> return $ mempty &#123;gray = [e]&#125;) &#32;&#32;(\\v -> return $ mempty &#123;exitV = [v]&#125;) &#32;&#32;(\\e -> return $ mempty &#123;black = [e]&#125;) @ Finally `runAdjacencylist` unwraps the function in the `Adjacencylist` newtype and runs it on `graph`. > dfsTest :: Orderings > dfsTest = runAdjacencyList (dfs orderings 0) graph Running `dfsTest` in ghci will yield: @ Orderings &#123;enterV = [0,2,3,1], enterE = [(0,2),(2,3),(0,1)], gray = [], exitV = [3,2,1,0], black = [(1,3)]&#125; @
versionuploadeduploaderchanges
0.7.32025-03-03 11:21 UTCryanglscott+19/−58 lines, 14 filesdep −semigroupsdep ~basedep ~containersPVP: major bump suggested
0.7.22022-05-07 23:42 UTCryanglscott1 revisions+52/−156 lines, 14 filesdep ~containersdep ~transformersPVP: major bump suggested
0.7.12018-02-24 20:56 UTCryanglscott1 revisions+180/−17 lines, 4 filesdep +semigroupsdep ~basedep ~containersnew-uploaderPVP: major bump suggested
0.72016-01-17 03:09 UTCEdwardKmett1 revisions+115/−18 lines, 15 filesdep +transformers-compatdep ~basedep ~transformersPVP ok
0.6.0.12015-01-10 22:10 UTCEdwardKmett+3/−3 lines, 1 filesdep ~arraydep ~transformersPVP ok
0.62015-01-10 20:34 UTCEdwardKmett+119/−148 lines, 12 files
0.5.0.12013-10-13 14:52 UTCEdwardKmett+3/−3 lines, 1 filesdep ~arraydep ~void
0.52013-09-05 13:53 UTCEdwardKmett+46/−9 lines, 8 filesPVP ok
0.4.12013-01-07 07:34 UTCEdwardKmett+1062/−1054 lines, 28 filesdep ~voidPVP ok
0.4.0.32012-05-11 21:52 UTCEdwardKmett+6/−2 lines, 2 filesdep ~arrayPVP ok
0.4.0.12012-05-08 23:22 UTCEdwardKmett+2/−2 lines, 1 filesdep ~containersPVP ok
0.42012-04-09 07:49 UTCEdwardKmett+8/−18 lines, 4 filesdep −data-defaultdep ~arraydep ~transformersdep ~voidPVP ok
0.3.2.32011-08-04 21:01 UTCEdwardKmett+5/−5 lines, 1 filesdep ~void
0.3.2.22011-07-26 22:14 UTCEdwardKmett+5/−1 lines, 1 files
0.3.2.12011-07-25 21:44 UTCEdwardKmett+2/−2 lines, 1 filesdep ~basePVP ok
0.3.22011-05-08 09:17 UTCEdwardKmett+2/−2 lines, 1 filesdep ~voidPVP ok
0.3.12011-01-25 17:28 UTCEdwardKmett+3/−3 lines, 2 filesdep ~basedep ~void
0.32011-01-22 12:09 UTCEdwardKmett1 revisions+5/−2 lines, 2 filesdep ~base
0.22011-01-21 18:46 UTCEdwardKmett+274/−88 lines, 9 files
0.12011-01-21 17:39 UTCEdwardKmett+954/−0 lines, 16 filesdep +arraydep +basedep +containerssetup-changed

Dependencies of graphs-0.7.3

array >=0.3 && <0.7 0.5.7.0 → 0.5.8.0
2024-09-08 07:13 UTC0.5.8.0+204/−8 lines, 6 filesdep ~basePVP ok
2024-04-12 14:38 UTC0.5.7.0+34/−17 lines, 9 filesdep ~basePVP: major bump suggested
2023-07-10 15:24 UTC0.5.6.0+159/−39 lines, 8 filesdep ~basenew-uploaderPVP ok
2023-02-13 16:01 UTC0.5.5.0+8/−4 lines, 3 filesdep ~basenew-uploaderPVP ok
2019-09-01 06:48 UTC0.5.4.0+33/−8 lines, 5 filesdep ~basesetup-changedPVP: major bump suggested

showing 5 of 18 versions

base >=4.9 && <5 4.22.0.0 → 4.22.1.0
2026-12-01 12:38 UTC4.22.1.0+388/−6 lines, 9 filesdep ~ghc-internalPVP: major bump suggested
2025-12-19 11:52 UTC4.22.0.0+886/−215 lines, 28 filesdep ~ghc-internalPVP ok
2026-03-27 12:26 UTC4.21.2.0+10/−3 lines, 4 filesdep ~ghc-internalPVP ok
2025-12-27 10:31 UTC4.21.1.0+17/−5 lines, 4 filesdep ~ghc-internalPVP ok
2024-12-16 09:24 UTC4.21.0.0+1170/−396 lines, 39 filesdep ~ghc-internalPVP ok

showing 5 of 61 versions

containers >=0.3 && <0.9 0.8 → 0.8.1
2026-10-04 06:08 UTC0.8.1+8085/−5169 lines, 39 filesdep +template-haskell-liftdep ~arraydep ~deepseqPVP: major bump suggested
2025-03-01 13:03 UTC0.8+8447/−7031 lines, 37 filesnew-uploaderPVP ok
2023-09-27 12:15 UTC0.7+76/−33 lines, 3 filesPVP ok
2023-09-28 04:21 UTC0.6.8+644/−184 lines, 17 filesdep ~basedep ~deepseqPVP: major bump suggested
2023-02-01 03:11 UTC0.6.7+783/−229 lines, 20 filesPVP: major bump suggested

showing 5 of 43 versions

transformers >=0.2.2 && <0.7 0.6.2.0 → 0.6.3.0
2026-01-12 12:42 UTC0.6.3.0+28/−1 lines, 4 filesPVP: major bump suggested
2025-04-06 22:39 UTC0.6.2.0+41/−42 lines, 8 filesdep ~ghc-primPVP: major bump suggested
2024-09-25 11:37 UTC0.6.1.2+70/−21 lines, 19 filesPVP: minor bump suggested
2023-08-01 19:13 UTC0.6.1.1+281/−42 lines, 11 filesPVP ok
2023-02-04 08:15 UTC0.6.1.0+64/−4 lines, 8 filesPVP ok

showing 5 of 42 versions

transformers-compat >=0.3 && <1 0.7.2 → 0.8
2026-01-11 02:47 UTC0.8+443/−4269 lines, 16 filesdep −faildep −generic-derivingdep −ghc-primdep ~basedep ~transformersPVP ok
2022-06-26 13:13 UTC0.7.2+631/−184 lines, 3 filesdep ~basePVP: major bump suggested
2021-10-30 16:41 UTC0.7.1+248/−3 lines, 5 filesPVP ok
2021-07-25 11:45 UTC0.7+858/−277 lines, 13 filesdep ~transformersPVP ok
2020-09-30 20:27 UTC0.6.6+275/−153 lines, 10 filesdep ~basePVP: major bump suggested

showing 5 of 38 versions

void >=0.5.5.1 && <1 0.7.3 → 0.7.4
2025-12-08 12:14 UTC0.7.4+18/−337 lines, 6 filesdep −deepseqdep −ghc-primdep −hashablePVP ok
2019-05-10 14:01 UTC0.7.3+198/−92 lines, 5 filesdep +template-haskellnew-uploaderPVP ok
2017-03-25 04:22 UTC0.7.2+134/−19 lines, 4 filesPVP ok
2015-09-13 18:16 UTC0.7.1+26/−7 lines, 6 filesdep +deepseqdep ~semigroupsPVP: major bump suggested
2014-12-02 09:57 UTC0.7+123/−114 lines, 4 filesdep ~basePVP ok

showing 5 of 27 versions

Reverse dependencies

1 packages depend on graphs

acme-everything 2018.11.18 requires graphs >=0