iota-0.1.0.0
Safe HaskellSafe-Inferred
LanguageGHC2021

Data.Graph.Sparse

Synopsis

Documentation

type EdgeWith w = (Vertex, Vertex, w) Source #

data SparseGraph w Source #

CSR (Compressed Sparse Row)

Constructors

SparseGraph 

Fields

data SparseGraphBuilder s w Source #

Constructors

SparseGraphBuilder 

Fields

buildSparseGraph Source #

Arguments

:: Unbox w 
=> Int

the number of vertices

-> Int

upper bound on the number of edges

-> (forall s. SparseGraphBuilder s w -> ST s ()) 
-> SparseGraph w 

addDirectedEdge :: (Unbox w, PrimMonad m) => SparseGraphBuilder (PrimState m) w -> EdgeWith w -> m () Source #

addUndirectedEdge :: (Unbox w, PrimMonad m) => SparseGraphBuilder (PrimState m) w -> EdgeWith w -> m () Source #

addDirectedEdge_ :: PrimMonad m => SparseGraphBuilder (PrimState m) () -> Edge -> m () Source #

addUndirectedEdge_ :: PrimMonad m => SparseGraphBuilder (PrimState m) () -> Edge -> m () Source #

buildDirectedGraph Source #

Arguments

:: Int

the number of vertices

-> Int

upper bound on the number of edges

-> Vector Edge 
-> SparseGraph () 

buildUndirectedGraph Source #

Arguments

:: Int

the number of vertices

-> Int

upper bound on the number of undirected edges

-> Vector Edge 
-> SparseGraph () 
>>> numEdgesSG . buildUndirectedGraph 2 1 $ U.fromList [(0, 1)]
2

buildDirectedGraphW Source #

Arguments

:: Unbox w 
=> Int

the number of vertices

-> Int

upper bound on the number of edges

-> Vector (EdgeWith w) 
-> SparseGraph w 

buildUndirectedGraphW Source #

Arguments

:: Unbox w 
=> Int

the number of vertices

-> Int

upper bound on the number of undirected edges

-> Vector (EdgeWith w) 
-> SparseGraph w 

adj :: SparseGraph w -> Vertex -> Vector Vertex Source #

iadj :: SparseGraph w -> Vertex -> Vector (EdgeId, Vertex) Source #

adjW :: Unbox w => SparseGraph w -> Vertex -> Vector (Vertex, w) Source #

iadjW :: Unbox w => SparseGraph w -> Vertex -> Vector (EdgeId, Vertex, w) Source #