packages feed

Graphalyze 0.9.0.0 → 0.10.0.0

raw patch · 7 files changed

+58/−61 lines, 7 filesdep ~bktreesdep ~fgldep ~graphviz

Dependency ranges changed: bktrees, fgl, graphviz, pandoc

Files

Data/Graph/Analysis.hs view
@@ -46,7 +46,7 @@ import Data.Graph.Inductive.Graph  import Data.List(find)-import Data.Maybe(mapMaybe, maybe)+import Data.Maybe(mapMaybe) import qualified Data.Map as M import Data.Map(Map) import qualified Data.Set as S@@ -67,17 +67,17 @@    to analyse.  If the graph is undirected, it is better to list each    edge once rather than both directions.  -}-data ImportParams n e = Params { -- | The discrete points.-                                 dataPoints :: [n],-                                 -- | The relationships between the points.-                                 relationships :: [Rel n e],-                                 -- | The expected roots of the graph.-                                 --   If @'directed' = 'False'@, then this is ignored.-                                 roots :: [n],-                                 -- | 'False' if relationships are symmetric-                                 --   (i.e. an undirected graph).-                                 directed :: Bool-                               }+data ImportParams n e = ImpParams { -- | The discrete points.+                                    dataPoints :: [n]+                                    -- | The relationships between the points.+                                  , relationships :: [Rel n e]+                                    -- | The expected roots of the graph.+                                    --   If @'directed' = 'False'@, then this is ignored.+                                  , roots :: [n]+                                    -- | 'False' if relationships are symmetric+                                    --   (i.e. an undirected graph).+                                  , directed :: Bool+                                  }  {- |    Import data into a format suitable for analysis.  This function is
Data/Graph/Analysis/Reporting.hs view
@@ -267,7 +267,7 @@ -- | Using a 6:4 ratio, create the given 'Point' representing --   width,height from the width. createSize   :: Double -> GraphSize-createSize w = GivenSize $ PointD w (w*4/6)+createSize w = GivenSize $ Point w (w*4/6)  -- | Replace all @.@ with @-@ in the given 'FilePath', since some output --   formats (e.g. LaTeX) don't like extraneous @.@'s in the filename.
Data/Graph/Analysis/Reporting/Pandoc.hs view
@@ -144,10 +144,10 @@  -- | Create the document. createPandoc     :: PandocDocument -> Document -> IO (Maybe FilePath)-createPandoc p d = do Right template <- getDefaultTemplate (templateName p)+createPandoc p d = do Right template <- getDefaultTemplate Nothing (templateName p)                       created <- tryCreateDirectory dir                       -- If the first one fails, so will this one.-                      tryCreateDirectory $ dir </> gdir+                      _ <- tryCreateDirectory $ dir </> gdir                       if not created                          then failDoc                          else do d' <- addLegend dir gdir (graphProps p) d
Data/Graph/Analysis/Types.hs view
@@ -212,14 +212,14 @@ class (Ord c) => ClusterType c where     -- | Create a label for visualisation purposes with the GraphViz     --   library.  Default is @'const' 'Nothing'@.-    clusterID :: c -> Maybe GraphID-    clusterID = const Nothing+    clustID :: c -> Maybe GraphID+    clustID = const Nothing  instance ClusterType Int where-    clusterID = Just . Int+    clustID = Just . Int  instance ClusterType String where-    clusterID = Just . Str+    clustID = Just . Str  -- | A generic cluster-label type. data GenCluster a = GC { clust :: Int
Data/Graph/Analysis/Utils.hs view
@@ -68,6 +68,8 @@  import Data.Graph.Inductive.Graph import Data.GraphViz( dotizeGraph+                    , GraphvizParams(isDirected)+                    , nonClusteredParams                     , Attribute(..)                     , Pos(..)                     , Point(..))@@ -186,14 +188,14 @@ --   labels.  The 'Bool' parameter denotes if the graph is directed or --   not. toPosGraph     :: (DynGraph gr, Ord b) => Bool -> gr a b -> gr (PosLabel a) b-toPosGraph dir = nlmap getPos . emap rmAttrs . dotizeGraph dir+toPosGraph dir = nlmap getPos . emap rmAttrs . dotizeGraph params     where+      params = nonClusteredParams{ isDirected = dir }       rmAttrs = snd-      isPoint attr = case attr of-                       Pos{} -> True-                       _     -> False-      getPos (n,(as,l)) = PLabel { xPos   = x-                                 , yPos   = y+      isPoint Pos{} = True+      isPoint _     = False+      getPos (n,(as,l)) = PLabel { xPos   = round x+                                 , yPos   = round y                                  , pnode  = n                                  , plabel = l                                  }
Data/Graph/Analysis/Visualisation.hs view
@@ -12,9 +12,8 @@       -- $graphviz       graphviz,       graphvizClusters,-      graphvizClusters',       assignCluster,-      noAttributes,+      setDir,       -- * Showing node groupings.       -- $other       showPath,@@ -45,43 +44,39 @@    Simple wrappers around the Haskell "Data.GraphViz" library to turn    'GraphData's into basic 'DotGraph's for processing by the GraphViz    suite of applications.--} --- | Convert the 'GraphData' into 'DotGraph' format with the given---   'Attribute's.-graphviz :: GraphData n e -> [GlobalAttributes]-            -> (LNode n -> Attributes)-            -> (LEdge e -> Attributes) -> DotGraph Node-graphviz = applyDirAlg graphToDot+   'blankParams' may be useful for creating initial definitions of+   'GraphvizParams', especially for 'graphvizClusters'.+-} --- | Convert the clustered 'GraphData' into 'DotGraph' format with the---   given 'Attribute's.  Cluster the nodes based upon their---   'ClusterLabel' clusters.-graphvizClusters :: (ClusterLabel cl) => GraphData cl e -> [GlobalAttributes]-                    -> (Cluster cl -> [GlobalAttributes])-                    -> (LNode (NodeLabel cl) -> Attributes)-                    -> (LEdge e -> Attributes) -> DotGraph Node-graphvizClusters g gas = graphvizClusters' g gas assignCluster clusterID+-- | Convert the 'GraphData' into 'DotGraph' format.+graphviz :: (Ord cl) => GraphvizParams nl el cl l+            -> GraphData nl el -> DotGraph Node+graphviz = setDir graphToDot --- | Convert the 'GraphData' into a clustered 'DotGraph' format using---   the given clustering function and with the given 'Attribute's.-graphvizClusters' :: (Ord c) => GraphData n e -> [GlobalAttributes]-                     -> (LNode n -> NodeCluster c l)-                     -> (c -> Maybe GraphID)-                     -> (c -> [GlobalAttributes]) -> (LNode l -> Attributes)-                     -> (LEdge e -> Attributes) -> DotGraph Node-graphvizClusters' = applyDirAlg clusterGraphToDot+-- | Convert the clustered 'GraphData' into 'DotGraph' format.+--   Cluster the nodes based upon their 'ClusterLabel' clusters.+graphvizClusters    :: (ClusterLabel nl)+                       => GraphvizParams nl el (Cluster nl) (NodeLabel nl)+                       -> GraphData nl el -> DotGraph Node+graphvizClusters ps = graphviz params+  where+    params = ps { clusterBy = assignCluster+                , clusterID = clustID+                } --- | A function to convert an 'LNode' to the required 'NodeCluster'+-- | A function to convert an 'LNode' to the required 'LNodeCluster' --   for use with the GraphViz library. assignCluster       :: (ClusterLabel cl) => LNode cl-                       -> NodeCluster (Cluster cl) (NodeLabel cl)+                       -> LNodeCluster (Cluster cl) (NodeLabel cl) assignCluster (n,a) = C (cluster a) $ N (n, nodeLabel a) --- | Used to state that GraphViz should use the default 'Attribute's---   for the given value.-noAttributes :: a -> Attributes-noAttributes = const []+-- | A cross between 'applyDirAlg' and 'setDirectedness'.+setDir :: (GraphvizParams nl el cl l -> AGr nl el -> a)+          -> GraphvizParams nl el cl l -> GraphData nl el -> a+setDir f params gd = f params' (graph gd)+  where+    params' = params { isDirected = directedData gd }  -- ----------------------------------------------------------------------------- 
Graphalyze.cabal view
@@ -1,5 +1,5 @@ Name:                Graphalyze-Version:             0.9.0.0+Version:             0.10.0.0 Synopsis:            Graph-Theoretic Analysis library. Description:         A library to use graph theory to analyse the relationships                         inherent in discrete data.@@ -29,10 +29,10 @@                          process,                          random,                          time,-                         bktrees >= 0.2,-                         fgl >= 5.4.2.2,-                         graphviz >= 2999.8.0.0 && < 2999.9.0.0,-                         pandoc >= 1.4 && < 1.5+                         bktrees >= 0.2 && <0.4,+                         fgl >= 5.4.2.3 && < 5.5,+                         graphviz >= 2999.10.0.0 && < 2999.11.0.0,+                         pandoc >= 1.5 && < 1.6          Exposed-Modules:     Data.Graph.Analysis                              Data.Graph.Analysis.Types