digraph 0.1.0.2 → 0.2
raw patch · 8 files changed
+55/−40 lines, 8 filessetup-changedPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
Files
- CHANGELOG.md +7/−0
- Setup.hs +2/−0
- digraph.cabal +7/−7
- src/Data/DiGraph.hs +32/−23
- src/Data/DiGraph/Random.hs +1/−2
- test/Data/DiGraph/Random/Test.hs +2/−3
- test/Data/DiGraph/Test.hs +2/−3
- test/Main.hs +2/−2
CHANGELOG.md view
@@ -1,5 +1,12 @@ # Revision history for digraph +## 0.2 -- 2020-05-19++* Fix the `twentyChainGraph` to have diameter 3 and match the respective graph+ from the chainweb paper.++* Allow build with base < 4.15+ ## 0.1.0.2 -- 2019-06-03 * Haddocks fixed for older Haddock versions.
+ Setup.hs view
@@ -0,0 +1,2 @@+import Distribution.Simple+main = defaultMain
digraph.cabal view
@@ -1,6 +1,6 @@ cabal-version: 2.2 name: digraph-version: 0.1.0.2+version: 0.2 synopsis: Directed Graphs description: Directed graphs implementation that is based on unordered-containers homepage: https://github.com/kadena-io/digraph@@ -9,12 +9,12 @@ license-file: LICENSE author: Lars Kuhtz maintainer: lars@kadena.io-copyright: Copyright (c) 2019, Kadena LLC+copyright: Copyright (c) 2019 - 2020, Kadena LLC category: Data, Mathematics tested-with:- GHC==8.6.5- , GHC==8.4.4- , GHC==8.2.2+ GHC==8.10.1+ , GHC==8.8.3+ , GHC==8.6.5 extra-source-files: README.md CHANGELOG.md@@ -33,7 +33,7 @@ , Data.DiGraph.FloydWarshall , Data.DiGraph.Random build-depends:- base >=4.10 && <4.14+ base >=4.10 && <4.15 , containers >=0.5 , deepseq >=1.4 , hashable >=1.2@@ -61,7 +61,7 @@ -- external , QuickCheck >=2.11- , base >=4.10 && <4.14+ , base >=4.10 && <4.15 , fgl >=5.7 , hashable >=1.2 , massiv >=0.3
src/Data/DiGraph.hs view
@@ -1,13 +1,13 @@-{-# LANGUAGE DeriveAnyClass #-}-{-# LANGUAGE DeriveGeneric #-}-{-# LANGUAGE DerivingStrategies #-}-{-# LANGUAGE LambdaCase #-}-{-# LANGUAGE OverloadedLists #-}+{-# LANGUAGE DeriveAnyClass #-}+{-# LANGUAGE DeriveGeneric #-}+{-# LANGUAGE DerivingStrategies #-}+{-# LANGUAGE LambdaCase #-}+{-# LANGUAGE OverloadedLists #-} {-# LANGUAGE ScopedTypeVariables #-} -- | -- Module: DiGraph--- Copyright: Copyright © 2018-2019 Kadena LLC.+-- Copyright: Copyright © 2018-2020 Kadena LLC. -- License: MIT -- Maintainer: Lars Kuhtz <lars@kadena.io> -- Stability: experimental@@ -85,25 +85,25 @@ ) where -import Control.Arrow-import Control.DeepSeq-import Control.Monad+import Control.Arrow+import Control.DeepSeq+import Control.Monad -import Data.Foldable-import Data.Hashable (Hashable)+import Data.Foldable+import Data.Hashable (Hashable) import qualified Data.HashMap.Strict as HM import qualified Data.HashSet as HS import qualified Data.List as L-import Data.Maybe-import Data.Semigroup-import Data.Traversable-import Data.Tuple+import Data.Maybe+import Data.Semigroup+import Data.Traversable+import Data.Tuple -import GHC.Generics+import GHC.Generics -import Numeric.Natural+import Numeric.Natural -import Prelude hiding (cycle)+import Prelude hiding (cycle) -- internal modules @@ -384,9 +384,9 @@ -- nodes of the graph. -- data ShortestPathCache a = ShortestPathCache- { _spcMatrix :: {-# UNPACK #-} !FW.ShortestPathMatrix+ { _spcMatrix :: {-# UNPACK #-} !FW.ShortestPathMatrix -- ^ The shortest path matrix of a graph.- , _spcIndices :: !(HM.HashMap a Int)+ , _spcIndices :: !(HM.HashMap a Int) -- ^ mapping from vertices of the graph to indices in the shortest path -- matrix. , _spcVertices :: !(HM.HashMap Int a)@@ -535,6 +535,11 @@ -- | The Peterson graph. --+-- * order: 10+-- * size: 30+-- * degree: 3+-- * diameter: 2+-- petersonGraph :: DiGraph Int petersonGraph = DiGraph [ (0, [2,3,5])@@ -551,12 +556,16 @@ -- | The "twenty chain" graph. --+-- * order: 20+-- * size: 60+-- * degree: 3+-- * diameter: 3+-- twentyChainGraph :: DiGraph Int-twentyChainGraph = pentagram `union` pentagon1 `union` pentagon2 `union` connections+twentyChainGraph = pentagram `union` decagon `union` connections where pentagram = mapVertices (+ 5) $ pentagon2pentagram $ cycle 5- pentagon1 = mapVertices (+ 10) $ cycle 5- pentagon2 = mapVertices (+ 15) $ cycle 5+ decagon = mapVertices (+ 10) $ cycle 10 connections = fromEdges $ HS.fromList $ mconcat [ [(i, x), (x, i)] | i <- [0..4]
src/Data/DiGraph/Random.hs view
@@ -4,7 +4,7 @@ -- | -- Module: Data.DiGraph.Random--- Copyright: Copyright © 2019 Kadena LLC.+-- Copyright: Copyright © 2019 - 2020 Kadena LLC. -- License: MIT -- Maintainer: Lars Kuhtz <lars@kadena.io> -- Stability: experimental@@ -130,4 +130,3 @@ choice = do v <- gen (0, maxBound) return $ int v <= p * int (maxBound :: Int)-
test/Data/DiGraph/Random/Test.hs view
@@ -9,7 +9,7 @@ -- | -- Module: Data.DiGraph.Random.Test--- Copyright: Copyright © 2019 Kadena LLC.+-- Copyright: Copyright © 2019 - 2020 Kadena LLC. -- License: MIT -- Maintainer: Lars Kuhtz <lars@kadena.io> -- Stability: experimental@@ -31,7 +31,7 @@ import qualified Data.Graph.Inductive.PatriciaTree as G import qualified Data.Graph.Inductive.Query.SP as G import Data.Hashable-import Data.Massiv.Array (Array(..), U, Ix2(..), makeArray, Comp(..))+import Data.Massiv.Array (Array(..), Comp(..), Ix2(..), U, makeArray) import qualified Data.Massiv.Array as M import Data.Proxy #if !MIN_VERSION_base(4,11,0)@@ -297,4 +297,3 @@ , properties_gnp , properties_rrg ]-
test/Data/DiGraph/Test.hs view
@@ -5,7 +5,7 @@ -- | -- Module: Data.DiGraph.Test--- Copyright: Copyright © 2019 Kadena LLC.+-- Copyright: Copyright © 2019 - 2020 Kadena LLC. -- License: MIT -- Maintainer: Lars Kuhtz <lars@kadena.io> -- Stability: experimental@@ -79,7 +79,7 @@ : ("size == 30", symSize g === 30) : ("outDegree == 3", maxOutDegree g === 3) : ("isRegular", property $ isRegular g)- : ("diameter == 2", diameter g === Just 4)+ : ("diameter == 3", diameter g === Just 3) : properties_undirected g where g = twentyChainGraph@@ -106,4 +106,3 @@ , properties_twentyChainGraph , properties_hoffmanSingletonGraph ]-
test/Main.hs view
@@ -5,7 +5,7 @@ -- | -- Module: Main--- Copyright: Copyright © 2019 Kadena LLC.+-- Copyright: Copyright © 2019 - 2020 Kadena LLC. -- License: MIT -- Maintainer: Lars Kuhtz <lars@kadena.io> -- Stability: experimental@@ -25,8 +25,8 @@ -- internal modules -import qualified Data.DiGraph.Test (properties) import qualified Data.DiGraph.Random.Test (properties)+import qualified Data.DiGraph.Test (properties) -- -------------------------------------------------------------------------- -- -- Support for QuickCheck < 2.12