ac-library-hs-0.1.0.0: Data structures and algorithms
Safe HaskellNone
LanguageGHC2021

AtCoder.Internal.Csr

Description

Immutable Compresed Sparse Row.

Example

>>> import AtCoder.Internal.Csr qualified as C
>>> let csr = build 3 $ VU.fromList @(Int, Int) [(0, 1), (0, 2), (0, 3), (1, 2), (2, 3)]
>>> csr `C.adj` 0
[1,2,3]
>>> csr `C.adj` 1
[2]
>>> csr `C.adj` 2
[3]

Since: 1.0.0

Synopsis

Compressed sparse row

data Csr e #

Comperssed Sparse Row.

Since: 1.0.0

Instances

Instances details
(Show e, Unbox e) => Show (Csr e) #

Since: 1.0.0

Instance details

Defined in AtCoder.Internal.Csr

Methods

showsPrec :: Int -> Csr e -> ShowS #

show :: Csr e -> String #

showList :: [Csr e] -> ShowS #

(Unbox e, Eq e) => Eq (Csr e) #

Since: 1.0.0

Instance details

Defined in AtCoder.Internal.Csr

Methods

(==) :: Csr e -> Csr e -> Bool #

(/=) :: Csr e -> Csr e -> Bool #

Constructor

build :: (HasCallStack, Unbox e) => Int -> Vector (Int, e) -> Csr e #

\(O(n + m)\) Creates Csr.

Since: 1.0.0

Accessors

adj :: (HasCallStack, Unbox e) => Csr e -> Int -> Vector e #

\(O(1)\) Returns adjacent vertices.

Since: 1.0.0