impure-containers-0.3: Mutable containers in haskell

Safe HaskellNone
LanguageHaskell2010

Data.Graph.Immutable

Synopsis

Documentation

dijkstra Source #

Arguments

:: (Ord s, Monoid s) 
=> (v -> v -> s -> e -> s) 
-> s

Weight to assign start vertex

-> Vertex g

start

-> Vertex g

end

-> Graph g e v 
-> s 

dijkstraTraversal Source #

Arguments

:: (Ord s, Monoid s) 
=> (v -> v -> s -> e -> s)

Weight combining function

-> s

Weight to assign start vertex

-> Vertex g

Start vertex

-> Graph g e v 
-> Vertices g s 

This is a generalization of Dijkstra's algorithm. This function could be written without unsafely pattern matching on Vertex, but doing so allows us to use a faster heap implementation.

lookupVertex :: Eq v => v -> Graph g e v -> Maybe (Vertex g) Source #

mapVertices :: (Vertex g -> a -> b) -> Graph g e a -> Graph g e b Source #

Not the same as fmap because the function also takes the vertex id.

traverseVertices_ :: Applicative m => (Vertex g -> v -> m a) -> Graph g e v -> m () Source #

traverseEdges_ :: Applicative m => (Vertex g -> Vertex g -> v -> v -> e -> m a) -> Graph g e v -> m () Source #

This traverses every edge in the entire graph.

traverseNeighbors_ :: Applicative m => (Vertex g -> v -> e -> m a) -> Vertex g -> Graph g e v -> m () Source #

Change this to use unsafeRead some time soon.

lookupEdge :: Vertex g -> Vertex g -> Graph g e v -> Maybe e Source #

mutableIForM_ :: PrimMonad m => MVector (PrimState m) a -> (Int -> a -> m b) -> m () Source #

mutableIFoldM' :: PrimMonad m => (a -> Int -> b -> m a) -> a -> MVector (PrimState m) b -> m a Source #

vertices :: Graph g e v -> Vertices g v Source #

size :: Graph g e v -> Size g Source #

verticesTraverse :: Applicative m => (Vertex g -> v -> m a) -> Vertices g v -> m (Vertices g a) Source #

This is currently inefficient. If an itraverse gets added to vector, this can be made faster.

verticesTraverse_ :: Applicative m => (Vertex g -> v -> m a) -> Vertices g v -> m () Source #

This is currently inefficient. If an itraverse gets added to vector, this can be made faster.

freeze :: PrimMonad m => MGraph g (PrimState m) e v -> m (Graph g e v) Source #

create :: PrimMonad m => (forall g. MGraph g (PrimState m) e v -> m ()) -> m (SomeGraph e v) Source #

Takes a function that builds on an empty MGraph. After the function mutates the MGraph, it is frozen and becomes an immutable SomeGraph.

with :: SomeGraph e v -> (forall g. Graph g e v -> a) -> a Source #