Graphalyze 0.11.0.0 → 0.12.0.0
raw patch · 6 files changed
+32/−23 lines, 6 filesdep +textdep ~graphvizdep ~pandoc
Dependencies added: text
Dependency ranges changed: graphviz, pandoc
Files
- Data/Graph/Analysis/Reporting.hs +7/−6
- Data/Graph/Analysis/Reporting/Pandoc.hs +1/−1
- Data/Graph/Analysis/Types.hs +12/−5
- Data/Graph/Analysis/Utils.hs +4/−4
- Data/Graph/Analysis/Visualisation.hs +4/−4
- Graphalyze.cabal +4/−3
Data/Graph/Analysis/Reporting.hs view
@@ -31,6 +31,8 @@ import Data.Graph.Inductive(Node) import Data.GraphViz+import Data.GraphViz.Attributes.Complete(Attribute(Size), Point(..), createPoint)+import Data.GraphViz.Exception import Data.Time(getZonedTime, zonedTimeToLocalTime, formatTime) import Control.Exception.Extensible(SomeException(..), tryJust)@@ -240,7 +242,8 @@ graphImage :: FilePath -> FilePath -> VisProperties -> DocGraph -> IO (Either DocInline Location)-graphImage rDir gDir vp dg = liftM (either' Text (File . fixPath))+graphImage rDir gDir vp dg = handle getErr+ . liftM (Right . File . fixPath) $ addExtension (runGraphviz dot) (format vp) filename@@ -249,6 +252,9 @@ filename = rDir </> gDir </> imageFile dg fixPath = makeRelative rDir + getErr :: GraphvizException -> IO (Either DocInline Location)+ getErr = return . Left. Text . show+ graphImage' :: FilePath -> FilePath -> VisProperties -> DocGraph -> IO DocInline graphImage' rDir gDir vp dg = liftM (either id f)@@ -278,8 +284,3 @@ where replace '.' = '-' replace c = c---- | Map either element of an 'Either'.-either' :: (a -> c) -> (b -> d) -> Either a b -> Either c d-either' fl _ (Left a) = Left $ fl a-either' _ fr (Right b) = Right $ fr b
Data/Graph/Analysis/Reporting/Pandoc.hs view
@@ -195,7 +195,7 @@ -- | Html output doesn't show the author and date; use this to print it. htmlInfo :: String -> String -> Block-htmlInfo auth dt = RawHtml html+htmlInfo auth dt = RawBlock "html" html where heading = "<h1>Document Information</h1>" html = unlines [heading, htmlize auth, htmlize dt]
Data/Graph/Analysis/Types.hs view
@@ -50,6 +50,8 @@ import qualified Data.Set as S import Data.Set(Set)+import qualified Data.Text.Lazy as T+import Data.Text.Lazy(Text) -- ----------------------------------------------------------------------------- @@ -211,15 +213,20 @@ -- | A class used to define which types are valid for clusters. class (Ord c) => ClusterType c where -- | Create a label for visualisation purposes with the GraphViz- -- library. Default is @'const' 'Nothing'@.- clustID :: c -> Maybe GraphID- clustID = const Nothing+ -- library.+ clustID :: c -> GraphID instance ClusterType Int where- clustID = Just . Int+ clustID = Int +instance ClusterType Double where+ clustID = Dbl++instance ClusterType Text where+ clustID = Str+ instance ClusterType String where- clustID = Just . Str+ clustID = clustID . T.pack -- | A generic cluster-label type. data GenCluster a = GC { clust :: Int
Data/Graph/Analysis/Utils.hs view
@@ -69,10 +69,10 @@ import Data.Graph.Inductive.Graph import Data.GraphViz( dotizeGraph , GraphvizParams(isDirected)- , nonClusteredParams- , Attribute(..)- , Pos(..)- , Point(..))+ , nonClusteredParams)+import Data.GraphViz.Attributes.Complete( Attribute(..)+ , Pos(..)+ , Point(..)) import Data.List(nub, nubBy, (\\), find, sort, sortBy, group, groupBy) import Data.Maybe(fromJust)
Data/Graph/Analysis/Visualisation.hs view
@@ -50,14 +50,14 @@ -} -- | Convert the 'GraphData' into 'DotGraph' format.-graphviz :: (Ord cl) => GraphvizParams nl el cl l+graphviz :: (Ord cl) => GraphvizParams Node nl el cl l -> GraphData nl el -> DotGraph Node graphviz = setDir graphToDot -- | 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)+ => GraphvizParams Node nl el (Cluster nl) (NodeLabel nl) -> GraphData nl el -> DotGraph Node graphvizClusters ps = graphviz params where@@ -72,8 +72,8 @@ assignCluster (n,a) = C (cluster a) $ N (n, nodeLabel a) -- | 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 :: (GraphvizParams Node nl el cl l -> AGr nl el -> a)+ -> GraphvizParams Node 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.11.0.0+Version: 0.12.0.0 Synopsis: Graph-Theoretic Analysis library. Description: A library to use graph theory to analyse the relationships inherent in discrete data.@@ -31,8 +31,9 @@ time, bktrees >= 0.2 && <0.4, fgl >= 5.4.2.3 && < 5.5,- graphviz >= 2999.11.0.0 && < 2999.12.0.0,- pandoc >= 1.5 && < 1.7+ graphviz == 2999.12.*,+ pandoc == 1.8.*,+ text Exposed-Modules: Data.Graph.Analysis Data.Graph.Analysis.Types