fgl 5.3 → 5.4.1.1
raw patch · 5 files changed
+42/−55 lines, 5 filesdep +arraydep +containersdep ~basesetup-changed
Dependencies added: array, containers
Dependency ranges changed: base
Files
- Data/Graph/Inductive.hs +2/−2
- Data/Graph/Inductive/Graph.hs +31/−49
- LICENSE +1/−1
- Setup.hs +4/−0
- fgl.cabal +4/−3
Data/Graph/Inductive.hs view
@@ -2,7 +2,7 @@ -- -- Inductive.hs -- Functional Graph Library ----- (c) 1999-2006 by Martin Erwig [see file COPYRIGHT]+-- (c) 1999-2007 by Martin Erwig [see file COPYRIGHT] -- ------------------------------------------------------------------------------ @@ -30,4 +30,4 @@ -- | Version info version :: IO ()-version = putStrLn "\nFGL - Functional Graph Library, June 2006"+version = putStrLn "\nFGL - Functional Graph Library, April 2007"
Data/Graph/Inductive/Graph.hs view
@@ -6,7 +6,7 @@ Node,LNode,UNode, Edge,LEdge,UEdge, -- ** Types Supporting Inductive Graph View- Adj,Context,MContext,Decomp,GDecomp,UDecomp,+ Adj,Context,MContext,Decomp,GDecomp,UContext,UDecomp, Path,LPath(..),UPath, -- * Graph Type Classes -- | We define two graph classes:@@ -292,9 +292,8 @@ -- | Build a quasi-unlabeled 'Graph'. mkUGraph :: Graph gr => [Node] -> [Edge] -> gr () () mkUGraph vs es = mkGraph (labUNodes vs) (labUEdges es) --labUEdges = map (\(v,w)->(v,w,()))-labUNodes = map (\v->(v,()))+ where labUEdges = map (\(v,w)->(v,w,()))+ labUNodes = map (\v->(v,())) -- | Find the context for the given 'Node'. Causes an error if the 'Node' is -- not present in the 'Graph'.@@ -313,36 +312,36 @@ -- | Find all 'Node's that have a link from the given 'Node'. suc :: Graph gr => gr a b -> Node -> [Node]-suc = map snd .: context4+suc = map snd .: context4l -- | Find all 'Node's that link to to the given 'Node'. pre :: Graph gr => gr a b -> Node -> [Node] -pre = map snd .: context1+pre = map snd .: context1l -- | Find all 'Node's that are linked from the given 'Node' and the label of -- each link. lsuc :: Graph gr => gr a b -> Node -> [(Node,b)]-lsuc = map flip2 .: context4+lsuc = map flip2 .: context4l -- | Find all 'Node's that link to the given 'Node' and the label of each link. lpre :: Graph gr => gr a b -> Node -> [(Node,b)] -lpre = map flip2 .: context1+lpre = map flip2 .: context1l -- | Find all outward-bound 'LEdge's for the given 'Node'. out :: Graph gr => gr a b -> Node -> [LEdge b] -out g v = map (\(l,w)->(v,w,l)) (context4 g v)+out g v = map (\(l,w)->(v,w,l)) (context4l g v) -- | Find all inward-bound 'LEdge's for the given 'Node'. inn :: Graph gr => gr a b -> Node -> [LEdge b] -inn g v = map (\(l,w)->(w,v,l)) (context1 g v)+inn g v = map (\(l,w)->(w,v,l)) (context1l g v) -- | The outward-bound degree of the 'Node'. outdeg :: Graph gr => gr a b -> Node -> Int-outdeg = length .: context4+outdeg = length .: context4l -- | The inward-bound degree of the 'Node'. indeg :: Graph gr => gr a b -> Node -> Int-indeg = length .: context1+indeg = length .: context1l -- | The degree of the 'Node'. deg :: Graph gr => gr a b -> Node -> Int@@ -366,35 +365,35 @@ -- | All 'Node's linked to in a 'Context'. suc' :: Context a b -> [Node]-suc' (_,_,_,s) = map snd s+suc' = map snd . context4l' -- | All 'Node's linked from in a 'Context'. pre' :: Context a b -> [Node] -pre' (p,_,_,_) = map snd p+pre' = map snd . context1l' -- | All 'Node's linked from in a 'Context', and the label of the links.-lpre' :: Context a b -> [(Node,b)] -lpre' (p,_,_,_) = map flip2 p+lsuc' :: Context a b -> [(Node,b)]+lsuc' = map flip2 . context4l' -- | All 'Node's linked from in a 'Context', and the label of the links.-lsuc' :: Context a b -> [(Node,b)]-lsuc' (_,_,_,s) = map flip2 s+lpre' :: Context a b -> [(Node,b)] +lpre' = map flip2 . context1l' -- | All outward-directed 'LEdge's in a 'Context'. out' :: Context a b -> [LEdge b] -out' (_,v,_,s) = map (\(l,w)->(v,w,l)) s+out' c@(_,v,_,_) = map (\(l,w)->(w,v,l)) (context4l' c) -- | All inward-directed 'LEdge's in a 'Context'. inn' :: Context a b -> [LEdge b] -inn' (p,v,_,_) = map (\(l,w)->(w,v,l)) p+inn' c@(_,v,_,_) = map (\(l,w)->(w,v,l)) (context1l' c) -- | The outward degree of a 'Context'. outdeg' :: Context a b -> Int-outdeg' (_,_,_,s) = length s+outdeg' = length . context4l' -- | The inward degree of a 'Context'. indeg' :: Context a b -> Int-indeg' (p,_,_,_) = length p+indeg' = length . context1l' -- | The degree of a 'Context'. deg' :: Context a b -> Int@@ -441,36 +440,19 @@ -- (.:) = (.) (.) (.) (.:) = (.) . (.) -fst4 (x,_,_,_) = x-{- not used-snd4 (_,x,_,_) = x-thd4 (_,_,x,_) = x--}-fth4 (_,_,_,x) = x--{- not used-fst3 (x,_,_) = x-snd3 (_,x,_) = x-thd3 (_,_,x) = x--}-+flip2 :: (a,b) -> (b,a) flip2 (x,y) = (y,x) - -- projecting on context elements ----- context1 g v = fst4 (contextP g v)-context1 :: Graph gr => gr a b -> Node -> Adj b-{- not used-context2 :: Graph gr => gr a b -> Node -> Node-context3 :: Graph gr => gr a b -> Node -> a--}-context4 :: Graph gr => gr a b -> Node -> Adj b+context1l :: Graph gr => gr a b -> Node -> Adj b+context1l = context1l' .: context -context1 = fst4 .: context-{- not used-context2 = snd4 .: context-context3 = thd4 .: context--}-context4 = fth4 .: context+context4l :: Graph gr => gr a b -> Node -> Adj b+context4l = context4l' .: context +context1l' :: Context a b -> Adj b +context1l' (p,v,_,s) = p++filter ((==v).snd) s++context4l' :: Context a b -> Adj b +context4l' (p,v,_,s) = s++filter ((==v).snd) p
LICENSE view
@@ -1,4 +1,4 @@-Copyright (c) 1999-2004, Martin Erwig+Copyright (c) 1999-2007, Martin Erwig All rights reserved. Redistribution and use in source and binary forms, with or without
Setup.hs view
@@ -1,2 +1,6 @@+module Main (main) where+ import Distribution.Simple++main :: IO () main = defaultMain
fgl.cabal view
@@ -1,7 +1,8 @@ name: fgl-version: 5.3+version: 5.4.1.1 license: BSD3 license-file: LICENSE+author: Martin Erwig maintainer: Martin Erwig homepage: http://web.engr.oregonstate.edu/~erwig/fgl/haskell category: Data Structures@@ -35,5 +36,5 @@ Data.Graph.Inductive.Query.SP, Data.Graph.Inductive.Query.TransClos, Data.Graph.Inductive-build-depends: base, mtl-extensions: MultiParamTypeClasses, OverlappingInstances+build-depends: base, mtl, containers, array+extensions: MultiParamTypeClasses, OverlappingInstances, FlexibleInstances