Commit 055a3114 authored by Kai Zhang's avatar Kai Zhang

v0.5.0

parent e3f55c20
Revision history for haskell-igraph Revision history for haskell-igraph
=================================== ===================================
v0.4.* -- v0.5.0 -- 2018-04-25
------------------- -------------------
* Fix memory leaks. * Fix memory leaks.
* Interface change: `mapNodes`, `mapEdges`, `filterNodes`, `filterEdges` become
`nmap`, `emap`, `nfilter`, `efilter`.
v0.4.0 -- 2018-04-20 v0.4.0 -- 2018-04-20
......
name: haskell-igraph name: haskell-igraph
version: 0.4.0 version: 0.5.0
synopsis: Haskell interface of the igraph library. synopsis: Haskell interface of the igraph library.
description: igraph<"http://igraph.org/c/"> is a library for creating description: igraph<"http://igraph.org/c/"> is a library for creating
and manipulating large graphs. This package provides the Haskell and manipulating large graphs. This package provides the Haskell
......
...@@ -4,8 +4,6 @@ module IGraph.Mutable ...@@ -4,8 +4,6 @@ module IGraph.Mutable
, MLGraph(..) , MLGraph(..)
, setEdgeAttr , setEdgeAttr
, setNodeAttr , setNodeAttr
, edgeAttr
, vertexAttr
)where )where
import Control.Monad (when, forM) import Control.Monad (when, forM)
...@@ -17,12 +15,6 @@ import IGraph.Internal ...@@ -17,12 +15,6 @@ import IGraph.Internal
import IGraph.Internal.Initialization import IGraph.Internal.Initialization
import IGraph.Types import IGraph.Types
vertexAttr :: String
vertexAttr = "vertex_attribute"
edgeAttr :: String
edgeAttr = "edge_attribute"
-- | Mutable labeled graph. -- | Mutable labeled graph.
newtype MLGraph m d v e = MLGraph IGraph newtype MLGraph m d v e = MLGraph IGraph
......
...@@ -29,12 +29,8 @@ inducedSubgraph :: (Hashable v, Eq v, Serialize v) => LGraph d v e -> [Int] -> L ...@@ -29,12 +29,8 @@ inducedSubgraph :: (Hashable v, Eq v, Serialize v) => LGraph d v e -> [Int] -> L
inducedSubgraph gr vs = unsafePerformIO $ do inducedSubgraph gr vs = unsafePerformIO $ do
vs' <- fromList $ map fromIntegral vs vs' <- fromList $ map fromIntegral vs
vsptr <- igraphVsVector vs' vsptr <- igraphVsVector vs'
g' <- igraphInducedSubgraph (_graph gr) vsptr IgraphSubgraphCreateFromScratch igraphInducedSubgraph (_graph gr) vsptr IgraphSubgraphCreateFromScratch >>=
nV <- igraphVcount g' unsafeFreeze . MLGraph
labels <- forM [0 .. nV - 1] $ \i ->
igraphHaskellAttributeVAS g' vertexAttr i >>= bsToByteString >>=
return . fromRight (error "decode failed") . decode
return $ LGraph g' $ M.fromListWith (++) $ zip labels $ map return [0..nV-1]
-- | Closeness centrality -- | Closeness centrality
closeness :: [Int] -- ^ vertices closeness :: [Int] -- ^ vertices
......
...@@ -12,3 +12,9 @@ data U ...@@ -12,3 +12,9 @@ data U
-- | Directed graph. -- | Directed graph.
data D data D
vertexAttr :: String
vertexAttr = "vertex_attribute"
edgeAttr :: String
edgeAttr = "edge_attribute"
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment