graph-wrapper 0.2.1 → 0.2.2
raw patch · 3 files changed
+32/−9 lines, 3 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
+ Data.Graph.Wrapper: toList :: Ord i => Graph i v -> [(i, v, [i])]
+ Data.Graph.Wrapper.Internal: G :: Graph -> Array Vertex i -> Array Vertex v -> Graph i v
+ Data.Graph.Wrapper.Internal: data Graph i v
+ Data.Graph.Wrapper.Internal: gVertexVertexArray :: Graph i v -> Array Vertex v
+ Data.Graph.Wrapper.Internal: graph :: Graph i v -> Graph
+ Data.Graph.Wrapper.Internal: indexGVertexArray :: Graph i v -> Array Vertex i
Files
- Data/Graph/Wrapper.hs +10/−7
- Data/Graph/Wrapper/Internal.hs +19/−0
- graph-wrapper.cabal +3/−2
Data/Graph/Wrapper.hs view
@@ -15,6 +15,7 @@ vertex, fromListSimple, fromList, fromListBy, fromVerticesEdges,+ toList, vertices, edges, successors, @@ -29,6 +30,8 @@ SCC(..), stronglyConnectedComponents, sccGraph ) where +import Data.Graph.Wrapper.Internal+ import Control.Arrow (second) import Control.Monad import Control.Monad.ST@@ -69,13 +72,6 @@ -- | An edge from the first vertex to the second type Edge i = (i, i) --- | A directed graph-data Graph i v = G {- graph :: G.Graph,- indexGVertexArray :: Array G.Vertex i,- gVertexVertexArray :: Array G.Vertex v- }- instance (Ord i, Show i, Show v) => Show (Graph i v) where show g = "fromVerticesEdges " ++ show ([(i, vertex g i) | i <- vertices g]) ++ " " ++ show (edges g) @@ -157,6 +153,13 @@ EQ -> mid GT -> go (mid + 1) b where mid = (a + b) `div` 2+++-- | Morally, the inverse of 'fromList'. The order of the elements in the output list is unspecified, as is the order of the edges+-- in each node's adjacency list. For this reason, @toList . fromList@ is not necessarily the identity function.+toList :: Ord i => Graph i v -> [(i, v, [i])]+toList g = [(indexGVertexArray g ! m, gVertexVertexArray g ! m, map (indexGVertexArray g !) ns) | (m, ns) <- assocs (graph g)]+ -- | Exhaustive list of vertices in the graph vertices :: Graph i v -> [i]
+ Data/Graph/Wrapper/Internal.hs view
@@ -0,0 +1,19 @@+-- | Exposes things that are considered to be too unstable for inclusion in the exports of "Data.Graph.Wrapper".+--+-- Use of this module should be avoided as it will change frequently and changes to this module alone will not necessarily+-- follow the Package Versioning Policy.+{-# OPTIONS_HADDOCK not-home #-}+module Data.Graph.Wrapper.Internal (+ Graph(..)+ ) where++import Data.Array+import qualified Data.Graph as G++-- | A directed graph+data Graph i v = G {+ graph :: G.Graph,+ indexGVertexArray :: Array G.Vertex i,+ gVertexVertexArray :: Array G.Vertex v+ }+
graph-wrapper.cabal view
@@ -1,17 +1,18 @@ Cabal-Version: >= 1.2 Build-Type: Simple Name: graph-wrapper-Version: 0.2.1+Version: 0.2.2 Maintainer: Max Bolingbroke <batterseapower@hotmail.com> Homepage: http://www.github.com/batterseapower/graph-wrapper License: BSD3 License-File: LICENSE Author: Max Bolingbroke Synopsis: A wrapper around the standard Data.Graph with a less awkward interface-Category: Data Structures+Category: Data Structures, Graphs Library Exposed-Modules: Data.Graph.Wrapper+ Data.Graph.Wrapper.Internal Build-Depends: base >= 3.0 && < 5.0, array >= 0.3 && < 0.4,