Defined in: packages/graph/src/graph.ts:168
The adjacency-matrix layout: an immutable dense matrix, what adjacencyMatrixGraph returns.
Extends
Section titled “Extends”GraphSurface
Properties
Section titled “Properties”vertexCount
Section titled “vertexCount”
readonlyvertexCount:number
Defined in: packages/graph/src/graph.ts:49
Vertices are the integers 0 … vertexCount - 1.
Inherited from
Section titled “Inherited from”GraphSurface.vertexCount
directed
Section titled “directed”
readonlydirected:boolean
Defined in: packages/graph/src/graph.ts:51
Whether an edge from u to v leaves v without a way back to u.
Inherited from
Section titled “Inherited from”GraphSurface.directed
forEachNeighbor
Section titled “forEachNeighbor”
readonlyforEachNeighbor: (vertex,visit) =>void
Defined in: packages/graph/src/graph.ts:61
Call visit(neighbor, weight) once per stored edge out of vertex, in
ascending neighbor id, with parallel copies in insertion order. An
unweighted edge reports weight 1. A hand-written adjacency reports a
finite number: an algorithm reading it throws INVALID_VERTEX for a
neighbor outside the graph and INVALID_WEIGHT for any other weight.
Parameters
Section titled “Parameters”vertex
Section titled “vertex”number
(neighbor, weight) => void
Returns
Section titled “Returns”void
Throws
Section titled “Throws”With code INVALID_VERTEX when vertex is not in 0 … vertexCount - 1.
Inherited from
Section titled “Inherited from”GraphSurface.forEachNeighbor
weighted
Section titled “weighted”
readonlyweighted:boolean
Defined in: packages/graph/src/graph.ts:115
Whether every edge stores a weight.
Inherited from
Section titled “Inherited from”GraphSurface.weighted
parallelEdges
Section titled “parallelEdges”
readonlyparallelEdges:boolean
Defined in: packages/graph/src/graph.ts:117
Whether repeated edges between the same endpoints are kept as separate copies.
Inherited from
Section titled “Inherited from”GraphSurface.parallelEdges
selfLoops
Section titled “selfLoops”
readonlyselfLoops:boolean
Defined in: packages/graph/src/graph.ts:119
Whether an edge may join a vertex to itself.
Inherited from
Section titled “Inherited from”GraphSurface.selfLoops
edgeCount
Section titled “edgeCount”
readonlyedgeCount:number
Defined in: packages/graph/src/graph.ts:121
Number of stored edges, each undirected edge and each self-loop counted once.
Inherited from
Section titled “Inherited from”GraphSurface.edgeCount
hasEdge
Section titled “hasEdge”
readonlyhasEdge: (from,to) =>boolean
Defined in: packages/graph/src/graph.ts:126
Whether an edge runs from from to to. Total: returns false for an
endpoint outside the graph instead of throwing.
Parameters
Section titled “Parameters”number
number
Returns
Section titled “Returns”boolean
Inherited from
Section titled “Inherited from”GraphSurface.hasEdge
outDegree
Section titled “outDegree”
readonlyoutDegree: (vertex) =>number
Defined in: packages/graph/src/graph.ts:133
How many stored edges leave vertex, parallel copies included and a
self-loop counted once.
Parameters
Section titled “Parameters”vertex
Section titled “vertex”number
Returns
Section titled “Returns”number
Throws
Section titled “Throws”With code INVALID_VERTEX when vertex is outside the graph.
Inherited from
Section titled “Inherited from”GraphSurface.outDegree
inDegree
Section titled “inDegree”
readonlyinDegree: (vertex) =>number
Defined in: packages/graph/src/graph.ts:139
How many stored edges enter vertex. Equal to outDegree on an undirected graph.
Parameters
Section titled “Parameters”vertex
Section titled “vertex”number
Returns
Section titled “Returns”number
Throws
Section titled “Throws”With code INVALID_VERTEX when vertex is outside the graph.
Inherited from
Section titled “Inherited from”GraphSurface.inDegree
forEachPredecessor
Section titled “forEachPredecessor”
readonlyforEachPredecessor: (vertex,visit) =>void
Defined in: packages/graph/src/graph.ts:147
Call visit(predecessor, weight) once per stored edge into vertex, in
ascending predecessor id. On an undirected graph this walks the same row as
forEachNeighbor.
Parameters
Section titled “Parameters”vertex
Section titled “vertex”number
(predecessor, weight) => void
Returns
Section titled “Returns”void
Throws
Section titled “Throws”With code INVALID_VERTEX when vertex is outside the graph.
Inherited from
Section titled “Inherited from”GraphSurface.forEachPredecessor
neighbors
Section titled “neighbors”
readonlyneighbors: (vertex) =>Int32Array
Defined in: packages/graph/src/graph.ts:154
The neighbors of vertex as a fresh Int32Array, in the order
forEachNeighbor visits them. Writing to it never changes the graph.
Parameters
Section titled “Parameters”vertex
Section titled “vertex”number
Returns
Section titled “Returns”Int32Array
Throws
Section titled “Throws”With code INVALID_VERTEX when vertex is outside the graph.
Inherited from
Section titled “Inherited from”GraphSurface.neighbors
readonlyedges: () =>GraphEdges
Defined in: packages/graph/src/graph.ts:159
Every edge as fresh columns, ordered by source and then by row order. An
undirected edge appears once, with source <= target.
Returns
Section titled “Returns”Inherited from
Section titled “Inherited from”GraphSurface.edges
readonlykind:"adjacency-matrix"
Defined in: packages/graph/src/graph.ts:169
The storage layout: 'adjacency-list', 'compressed-sparse-row', or 'adjacency-matrix'.
Overrides
Section titled “Overrides”GraphSurface.kind