Skip to content

Typed API (TypeDoc)


Typed API (TypeDoc) / AdjacencyMatrix

Class: AdjacencyMatrix

Defined in: graph/src/matrix/adjacency-matrix.ts:8

Constructors

Constructor

new AdjacencyMatrix(vertexCount): AdjacencyMatrix

Defined in: graph/src/matrix/adjacency-matrix.ts:19

Parameters

vertexCount

number

Initial number of vertices; may be zero.

Returns

AdjacencyMatrix

Description

Create a new adjacency matrix sized to the provided vertex count.

Accessors

dimension

Get Signature

get dimension(): number

Defined in: graph/src/matrix/adjacency-matrix.ts:26

Description

Current width/height (number of vertices) of the matrix.

Returns

number

Methods

get()

get(i, j): 0 | 1

Defined in: graph/src/matrix/adjacency-matrix.ts:33

Parameters

i

number

j

number

Returns

0 | 1

Description

Returns the adjacency flag between vertex i and j.


resize()

resize(newSize): void

Defined in: graph/src/matrix/adjacency-matrix.ts:65

Parameters

newSize

number

Returns

void

Description

Grow or shrink the matrix to match the new vertex count.

Description

When growing we keep existing values and zero any new cells.


set()

set(i, j, value): void

Defined in: graph/src/matrix/adjacency-matrix.ts:45

Parameters

i

number

j

number

value

0 | 1

Returns

void

Description

Mutates the adjacency flag between vertex i and j.

Built with VitePress – Released under the MIT License.