impure-containers-0.3: Mutable containers in haskell

Safe HaskellNone
LanguageHaskell2010

Data.Graph.Mutable

Synopsis

Documentation

verticesUReplicate :: (PrimMonad m, Unbox v) => Size g -> v -> m (MUVertices g (PrimState m) v) Source #

verticesUWrite :: (PrimMonad m, Unbox v) => MUVertices g (PrimState m) v -> Vertex g -> v -> m () Source #

verticesWrite :: PrimMonad m => MVertices g (PrimState m) v -> Vertex g -> v -> m () Source #

verticesURead :: (PrimMonad m, Unbox v) => MUVertices g (PrimState m) v -> Vertex g -> m v Source #

insertVertex :: (PrimMonad m, Hashable v, Eq v) => MGraph g (PrimState m) e v -> v -> m (Vertex g) Source #

This does two things:

  • Check to see if a vertex with the provided value already exists
  • Create a new vertex if it does not exist

In either case, the vertex id is returned, regardless or whether it was preexisting or newly created.

insertEdge :: PrimMonad m => MGraph g (PrimState m) e v -> Vertex g -> Vertex g -> e -> m () Source #

This replaces the edge if it already exists. If you pass the same vertex as the source and the destination, this function has no effect.

insertEdgeWith :: PrimMonad m => MGraph g (PrimState m) e v -> (e -> e -> e) -> Vertex g -> Vertex g -> e -> m () Source #

Insert edge with a function, combining the existing edge value and the old one.