intmap-graph 1.1.0.0 → 1.2.0.0
raw patch · 2 files changed
+11/−3 lines, 2 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
Files
- intmap-graph.cabal +1/−1
- src/Graph/IntMap.hs +10/−2
intmap-graph.cabal view
@@ -1,5 +1,5 @@ name: intmap-graph-version: 1.1.0.0+version: 1.2.0.0 Synopsis: A graph library that allows to explore edges after their type Description: It is easiest to explain this library with an example: A node has 300 outgoing edges, 100 red, 100 green, 100 blue. If you want to explore all green edges, most of the other graph libraries force you to look up all 300 edges and then filter after the property green. This means 300 O(log n) calls. With this library there is only one (log n) call necessary that gives a list of all green edges. homepage: https://github.com/tkvogt/intmap-graph#readme
src/Graph/IntMap.hs view
@@ -128,10 +128,11 @@ nodeDests1 = map Set.toList (I.elems incomingNodes) lines or e dests = concat (map (line . f) dests) where f d = (or,e,d)- line (or, e, dest) = extr or ++ show or ++ " -> "++ extr dest ++ show dest ++" [ label = \"" +++ line (or, e, dest) = extr nlGraph or ++ show or ++ " -> "++ extr nlGraph dest ++ show dest ++" [ label = \"" ++ show_e (Map.lookup e showEdge) ++ "\" ];\n"- extr n = maybe "" extractNodeType (I.lookup (fromIntegral n) nlGraph) +extr g n = maybe "" extractNodeType (I.lookup (fromIntegral n) g)+ ------------------------------------------------------------------------------------------ -- | Generate an empty graph with 32 bit node-edges (24 bit for the node) that can be @@ -192,6 +193,13 @@ adjustNode :: EdgeAttribute el => (nl -> nl) -> Node -> Graph nl el -> Graph nl el adjustNode f n graph = -- Debug.Trace.trace "insertNode" $ graph { nodeLabels = I.adjust f (fromIntegral n) (nodeLabels graph) }+++-- | Adjust an edge label of a specific edge. When the edge is not a member of the graph, the original graph is returned.+adjustEdge :: EdgeAttribute el => (el -> el) -> Edge -> Graph nl el -> Graph nl el+adjustEdge f (n0,n1) graph = -- Debug.Trace.trace "insertNode" $+ graph { edgeLabels = Map.adjust f (fromIntegral n0, fromIntegral n1) (edgeLabels graph) }+ -- | Inserting an edge -- If maybeIsBack is Nothing only one directed is edge from n0 to n1 is inserted