Safe Haskell | Safe-Inferred |
---|---|
Language | GHC2021 |
Synopsis
- type Vertex = Int
- type Edge = (Vertex, Vertex)
- type EdgeWith w = (Vertex, Vertex, w)
- type EdgeId = Int
- data SparseGraph w = SparseGraph {
- numVerticesSG :: !Int
- numEdgesSG :: !Int
- offsetSG :: !(Vector Int)
- adjacentSG :: !(Vector Vertex)
- edgeCtxSG :: !(Vector w)
- data SparseGraphBuilder s w = SparseGraphBuilder {}
- buildSparseGraph :: Unbox w => Int -> Int -> (forall s. SparseGraphBuilder s w -> ST s ()) -> SparseGraph w
- addDirectedEdge :: (Unbox w, PrimMonad m) => SparseGraphBuilder (PrimState m) w -> EdgeWith w -> m ()
- addUndirectedEdge :: (Unbox w, PrimMonad m) => SparseGraphBuilder (PrimState m) w -> EdgeWith w -> m ()
- addDirectedEdge_ :: PrimMonad m => SparseGraphBuilder (PrimState m) () -> Edge -> m ()
- addUndirectedEdge_ :: PrimMonad m => SparseGraphBuilder (PrimState m) () -> Edge -> m ()
- buildDirectedGraph :: Int -> Int -> Vector Edge -> SparseGraph ()
- buildUndirectedGraph :: Int -> Int -> Vector Edge -> SparseGraph ()
- buildDirectedGraphW :: Unbox w => Int -> Int -> Vector (EdgeWith w) -> SparseGraph w
- buildUndirectedGraphW :: Unbox w => Int -> Int -> Vector (EdgeWith w) -> SparseGraph w
- adj :: SparseGraph w -> Vertex -> Vector Vertex
- iadj :: SparseGraph w -> Vertex -> Vector (EdgeId, Vertex)
- adjW :: Unbox w => SparseGraph w -> Vertex -> Vector (Vertex, w)
- iadjW :: Unbox w => SparseGraph w -> Vertex -> Vector (EdgeId, Vertex, w)
- outEdges :: SparseGraph w -> Vertex -> Vector EdgeId
- outDegree :: SparseGraph w -> Vertex -> Int
- outDegrees :: SparseGraph w -> Vector Int
Documentation
data SparseGraph w Source #
CSR (Compressed Sparse Row)
SparseGraph | |
|
data SparseGraphBuilder s w Source #
:: 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 #
:: Int | the number of vertices |
-> Int | upper bound on the number of edges |
-> Vector Edge | |
-> SparseGraph () |
:: 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
:: Unbox w | |
=> Int | the number of vertices |
-> Int | upper bound on the number of edges |
-> Vector (EdgeWith w) | |
-> SparseGraph w |
buildUndirectedGraphW Source #
:: Unbox w | |
=> Int | the number of vertices |
-> Int | upper bound on the number of undirected edges |
-> Vector (EdgeWith w) | |
-> SparseGraph w |
outDegrees :: SparseGraph w -> Vector Int Source #