Skip to content

@graphty/graphty-element / extend / GraphSnapshot

Interface: GraphSnapshot ​

Defined in: graph-format/dist/src/snapshot/graph-snapshot.d.ts:45

The frozen graph (design section 3): a CSR core over 4-byte typed arrays, the id map, the attribute tables, the flags and a per-instance view cache. Topology, counts, flags, id map and immutable columns never change after construction (invariant I17); the column SET of nodes / edges / graph and the CONTENTS of columns declared mutable are mutable side tables (design section 5.8). Every view is a pure function of the core, memoised once and SHARED: a call returns the cached array itself, so writing into a view is a contract violation; call .slice() for scratch. Index-taking queries are total for in-range arguments and unchecked otherwise (design section 11.1). Instances come from createSnapshot() (the builder, fromCsr, fromWire and the derived-graph methods); isGraphSnapshot() recognises them structurally by brand and formatVersion.

Implements ​

  • GraphSnapshotContract

Properties ​

[SNAPSHOT_BRAND] ​

readonly [SNAPSHOT_BRAND]: true

Defined in: graph-format/dist/src/snapshot/graph-snapshot.d.ts:47

Symbol.for brand read by isGraphSnapshot() (design section 7.5).

Implementation of ​

GraphSnapshotContract.[SNAPSHOT_BRAND]


arcCount ​

readonly arcCount: number

Defined in: graph-format/dist/src/snapshot/graph-snapshot.d.ts:61

colIdx.length (invariants I6, I7).

Implementation of ​

GraphSnapshotContract.arcCount


arena ​

readonly arena: ArenaLayout | null

Defined in: graph-format/dist/src/snapshot/graph-snapshot.d.ts:85

The arena holding the core arrays, or null (design section 10.3).

Implementation of ​

GraphSnapshotContract.arena


colIdx ​

readonly colIdx: U32

Defined in: graph-format/dist/src/snapshot/graph-snapshot.d.ts:67

Target node index of each arc, sorted within each row (invariants I2, I4).

Implementation of ​

GraphSnapshotContract.colIdx


directed ​

readonly directed: boolean

Defined in: graph-format/dist/src/snapshot/graph-snapshot.d.ts:55

Whether the graph is directed.

Implementation of ​

GraphSnapshotContract.directed


edgeCount ​

readonly edgeCount: number

Defined in: graph-format/dist/src/snapshot/graph-snapshot.d.ts:59

Number of logical edges (invariant I13).

Implementation of ​

GraphSnapshotContract.edgeCount


edges ​

readonly edges: AttributeTable

Defined in: graph-format/dist/src/snapshot/graph-snapshot.d.ts:77

Edge attribute table, rowCount === edgeCount, indexed by logical edge.

Implementation of ​

GraphSnapshotContract.edges


extensions ​

readonly extensions: ReadonlyMap<string, AttributeTable>

Defined in: graph-format/dist/src/snapshot/graph-snapshot.d.ts:81

Extension tables keyed by name (design section 5.10).

Implementation of ​

GraphSnapshotContract.extensions


flags ​

readonly flags: SnapshotFlags

Defined in: graph-format/dist/src/snapshot/graph-snapshot.d.ts:71

Flags kernels branch on (design section 3.8).

Implementation of ​

GraphSnapshotContract.flags


formatVersion ​

readonly formatVersion: 1

Defined in: graph-format/dist/src/snapshot/graph-snapshot.d.ts:53

The data-model major (design section 13.5).

Implementation of ​

GraphSnapshotContract.formatVersion


graph ​

readonly graph: AttributeTable

Defined in: graph-format/dist/src/snapshot/graph-snapshot.d.ts:79

Graph attribute table, rowCount === 1.

Implementation of ​

GraphSnapshotContract.graph


ids ​

readonly ids: NodeIdMap

Defined in: graph-format/dist/src/snapshot/graph-snapshot.d.ts:73

The id map (design section 4).

Implementation of ​

GraphSnapshotContract.ids


label ​

readonly label: string | null

Defined in: graph-format/dist/src/snapshot/graph-snapshot.d.ts:51

Debugging aid supplied at freeze.

Implementation of ​

GraphSnapshotContract.label


meta ​

readonly meta: GraphMeta

Defined in: graph-format/dist/src/snapshot/graph-snapshot.d.ts:83

Graph-level metadata (design section 5.9).

Implementation of ​

GraphSnapshotContract.meta


nodeCount ​

readonly nodeCount: number

Defined in: graph-format/dist/src/snapshot/graph-snapshot.d.ts:57

n (invariant I3).

Implementation of ​

GraphSnapshotContract.nodeCount


nodes ​

readonly nodes: AttributeTable

Defined in: graph-format/dist/src/snapshot/graph-snapshot.d.ts:75

Node attribute table, rowCount === nodeCount.

Implementation of ​

GraphSnapshotContract.nodes


rowPtr ​

readonly rowPtr: U32

Defined in: graph-format/dist/src/snapshot/graph-snapshot.d.ts:65

nodeCount + 1 row offsets (invariant I1).

Implementation of ​

GraphSnapshotContract.rowPtr


selfLoopCount ​

readonly selfLoopCount: number

Defined in: graph-format/dist/src/snapshot/graph-snapshot.d.ts:63

Logical edges with source === target.

Implementation of ​

GraphSnapshotContract.selfLoopCount


serial ​

readonly serial: number

Defined in: graph-format/dist/src/snapshot/graph-snapshot.d.ts:49

Process-unique identity of the CORE; shared by withColumns() snapshots (design section 5.8).

Implementation of ​

GraphSnapshotContract.serial


weights ​

readonly weights: F32 | null

Defined in: graph-format/dist/src/snapshot/graph-snapshot.d.ts:69

arcCount f32 weights; null when unweighted.

Implementation of ​

GraphSnapshotContract.weights

Accessors ​

arcToEdge ​

Get Signature ​

get arcToEdge(): U32

Defined in: graph-format/dist/src/snapshot/graph-snapshot.d.ts:105

Logical edge of every arc (invariant I5); an identity permutation is materialised on first access as a separate 4-byte-aligned array outside the arena. GPU code tests flags.arcToEdgeIsIdentity before reading it.

Returns ​

U32

arcCount entries; E_DETACHED after a consuming transfer

Implementation of ​

GraphSnapshotContract.arcToEdge


detached ​

Get Signature ​

get detached(): boolean

Defined in: graph-format/dist/src/snapshot/graph-snapshot.d.ts:98

rowPtr.length === 0: the core buffer was transferred away (design section 9.4). Derived from the array state, never a stored bit, so every holder of the same core agrees.

Returns ​

boolean

true when detached

Implementation of ​

GraphSnapshotContract.detached


edgeToArc ​

Get Signature ​

get edgeToArc(): U32

Defined in: graph-format/dist/src/snapshot/graph-snapshot.d.ts:111

The arc holding the declared orientation of every logical edge (invariant I5); an identity permutation is materialised on first access outside the arena.

Returns ​

U32

edgeCount entries; E_DETACHED after a consuming transfer

Implementation of ​

GraphSnapshotContract.edgeToArc

Methods ​

arcsBetween() ​

arcsBetween(u, v): readonly [number, number]

Defined in: graph-format/dist/src/snapshot/graph-snapshot.d.ts:145

The half-open arc range [lo, hi) of every arc u -> v; empty when lo === hi. Allocates a tuple.

Parameters ​

u ​

number

the source node index

v ​

number

the target node index

Returns ​

readonly [number, number]

the range as [lo, hi]

Implementation of ​

GraphSnapshotContract.arcsBetween


arcSource() ​

arcSource(a): number

Defined in: graph-format/dist/src/snapshot/graph-snapshot.d.ts:158

The row containing an arc: O(1) through the cached coo() view, else a binary search on rowPtr.

Parameters ​

a ​

number

the arc index

Returns ​

number

the source node index

Implementation of ​

GraphSnapshotContract.arcSource


byteLength() ​

byteLength(options?): number

Defined in: graph-format/dist/src/snapshot/graph-snapshot.d.ts:374

Resident bytes of the core (an identity permutation counts zero even when materialised), plus the side structures selected by the options.

Parameters ​

options? ​

ByteLengthOptions

which side structures to include

Returns ​

number

the byte count

Implementation of ​

GraphSnapshotContract.byteLength


cachedViews() ​

cachedViews(): readonly ViewName[]

Defined in: graph-format/dist/src/snapshot/graph-snapshot.d.ts:296

Which views are resident.

Returns ​

readonly ViewName[]

the names of the cached views, in the fixed ViewName order

Implementation of ​

GraphSnapshotContract.cachedViews


contentHash() ​

contentHash(): string

Defined in: graph-format/dist/src/snapshot/graph-snapshot.d.ts:380

A 64-bit content hash of the core arrays (two 32-bit FNV-1a lanes) as 16 hex characters, computed lazily and cached (design section 9.3).

Returns ​

string

the hash

Implementation of ​

GraphSnapshotContract.contentHash


contract() ​

contract(partition, options?): DerivedGraph

Defined in: graph-format/dist/src/snapshot/graph-snapshot.d.ts:344

Contract the nodes of each partition block into one node (design section 7.3).

Parameters ​

partition ​

U32

one label per node; E_PARTITION for a wrong length or an INVALID_INDEX label

options? ​

ContractOptions

weight reducer, self-loop and parallel policies, column reducers

Returns ​

DerivedGraph

the derived graph with blockSizes and an identity id map

Implementation of ​

GraphSnapshotContract.contract


coo() ​

coo(): CooView

Defined in: graph-format/dist/src/snapshot/graph-snapshot.d.ts:188

Per-arc COO form; src is the only new array. Cached and shared.

Returns ​

CooView

the COO view

Implementation of ​

GraphSnapshotContract.coo


degree() ​

degree(): U32

Defined in: graph-format/dist/src/snapshot/graph-snapshot.d.ts:211

Graph-theoretic degree (NetworkX convention, design section 3.4): in + out when directed; out plus self-loops when undirected. Cached and shared: call .slice() before writing.

Returns ​

U32

Uint32Array(n)

Implementation of ​

GraphSnapshotContract.degree


degreeOrder() ​

degreeOrder(options?): DegreeOrderView

Defined in: graph-format/dist/src/snapshot/graph-snapshot.d.ts:272

Nodes ordered by descending out-degree of the forward or reverse adjacency with the cuGraph tier boundaries. Both variants cached; on an undirected snapshot they are the same object.

Parameters ​

options? ​

DegreeOrderOptions

which adjacency's degree to order by

Returns ​

DegreeOrderView

the permutation and its tier offsets

Implementation of ​

GraphSnapshotContract.degreeOrder


dropCaches() ​

dropCaches(): void

Defined in: graph-format/dist/src/snapshot/graph-snapshot.d.ts:291

Release every cached view (and every identity permutation materialised on demand) and every cached gpuView() f32 copy of an f64 column (design section 7.2); they are recomputed on demand. The checksum records of the dropped views are dropped with them.

Returns ​

void

Implementation of ​

GraphSnapshotContract.dropCaches


edgeIndexOf() ​

edgeIndexOf(id): number

Defined in: graph-format/dist/src/snapshot/graph-snapshot.d.ts:177

Lookup through the role "id" edge column, backed by a Map built on first call and rebuilt when the column is replaced or a mutable id column's version changes (design section 4.6).

Parameters ​

id ​

EdgeId

the edge id

Returns ​

number

the logical edge index, or INVALID_INDEX on a miss or when no id column exists

Implementation of ​

GraphSnapshotContract.edgeIndexOf


edgeList() ​

edgeList(): EdgeListView

Defined in: graph-format/dist/src/snapshot/graph-snapshot.d.ts:193

Every logical edge once in declared orientation. Cached and shared.

Returns ​

EdgeListView

the edge list view

Implementation of ​

GraphSnapshotContract.edgeList


edgeSource() ​

edgeSource(e): number

Defined in: graph-format/dist/src/snapshot/graph-snapshot.d.ts:164

Declared source of a logical edge: arcSource(edgeToArc[e]).

Parameters ​

e ​

number

the logical edge index

Returns ​

number

the source node index

Implementation of ​

GraphSnapshotContract.edgeSource


edgeTarget() ​

edgeTarget(e): number

Defined in: graph-format/dist/src/snapshot/graph-snapshot.d.ts:170

Declared target of a logical edge: colIdx[edgeToArc[e]].

Parameters ​

e ​

number

the logical edge index

Returns ​

number

the target node index

Implementation of ​

GraphSnapshotContract.edgeTarget


filterEdges() ​

filterEdges(keep): DerivedGraph

Defined in: graph-format/dist/src/snapshot/graph-snapshot.d.ts:327

Keep the logical edges whose mask bit is set.

Parameters ​

keep ​

U32

packed bitmap over logical edges; E_MASK_LENGTH when shorter than ceil(edgeCount / 32) words

Returns ​

DerivedGraph

the derived graph

Implementation of ​

GraphSnapshotContract.filterEdges


findArc() ​

findArc(u, v): number

Defined in: graph-format/dist/src/snapshot/graph-snapshot.d.ts:131

Binary search for the first arc u -> v (the lowest logical edge index among parallels).

Parameters ​

u ​

number

the source node index

v ​

number

the target node index

Returns ​

number

the arc index, or INVALID_INDEX when absent

Implementation of ​

GraphSnapshotContract.findArc


hasArc() ​

hasArc(u, v): boolean

Defined in: graph-format/dist/src/snapshot/graph-snapshot.d.ts:138

Whether an arc u -> v exists.

Parameters ​

u ​

number

the source node index

v ​

number

the target node index

Returns ​

boolean

findArc(u, v) !== INVALID_INDEX

Implementation of ​

GraphSnapshotContract.hasArc


inDegree() ​

inDegree(): U32

Defined in: graph-format/dist/src/snapshot/graph-snapshot.d.ts:205

Arcs targeting each node, via reverse().rowPtr; the same object as outDegree() when undirected. Cached and shared: call .slice() before writing.

Returns ​

U32

Uint32Array(n)

Implementation of ​

GraphSnapshotContract.inDegree


inducedSubgraph() ​

inducedSubgraph(selection): DerivedGraph

Defined in: graph-format/dist/src/snapshot/graph-snapshot.d.ts:335

The subgraph induced by a node selection: an index list (order = new index order; E_INDEX_RANGE for an out-of-range or repeated index) or a packed mask (ascending order; E_MASK_LENGTH when short). Edges with both endpoints kept.

Parameters ​

selection ​

U32 | { mask: U32; }

the node indices or a mask

Returns ​

DerivedGraph

the derived graph

Implementation of ​

GraphSnapshotContract.inducedSubgraph


isSymmetric() ​

isSymmetric(): boolean

Defined in: graph-format/dist/src/snapshot/graph-snapshot.d.ts:278

Whether the arc set is closed under reversal with equal weights (forward row v equals reverse row v for every v); true without work when undirected. Cached.

Returns ​

boolean

true when symmetric

Implementation of ​

GraphSnapshotContract.isSymmetric


mate() ​

mate(): U32

Defined in: graph-format/dist/src/snapshot/graph-snapshot.d.ts:265

For every arc, the arc storing the opposite orientation of the same edge (a self-loop maps to itself); the lockstep walk of design section 6.4. Undirected only. Cached and shared: call .slice() before writing.

Returns ​

U32

Uint32Array(arcCount); E_DIRECTED on a directed snapshot

Implementation of ​

GraphSnapshotContract.mate


multiplicity() ​

multiplicity(u, v): number

Defined in: graph-format/dist/src/snapshot/graph-snapshot.d.ts:152

Number of parallel arcs u -> v.

Parameters ​

u ​

number

the source node index

v ​

number

the target node index

Returns ​

number

hi - lo of arcsBetween(u, v)

Implementation of ​

GraphSnapshotContract.multiplicity


outArcs() ​

outArcs(u): readonly [number, number]

Defined in: graph-format/dist/src/snapshot/graph-snapshot.d.ts:118

The out-arc range of a node: [rowPtr[u], rowPtr[u + 1]]. Allocates a tuple; hot loops read rowPtr directly.

Parameters ​

u ​

number

the node index

Returns ​

readonly [number, number]

the half-open arc range as [start, end]

Implementation of ​

GraphSnapshotContract.outArcs


outDegree() ​

outDegree(): U32

Defined in: graph-format/dist/src/snapshot/graph-snapshot.d.ts:199

rowPtr differences materialised; a self-loop counted once. Cached and shared: call .slice() before writing.

Returns ​

U32

Uint32Array(n)

Implementation of ​

GraphSnapshotContract.outDegree


outDegreeOf() ​

outDegreeOf(u): number

Defined in: graph-format/dist/src/snapshot/graph-snapshot.d.ts:124

rowPtr[u + 1] - rowPtr[u]: the out-arc count (a self-loop counted once).

Parameters ​

u ​

number

the node index

Returns ​

number

the out-degree

Implementation of ​

GraphSnapshotContract.outDegreeOf


prepare() ​

prepare(views): this

Defined in: graph-format/dist/src/snapshot/graph-snapshot.d.ts:285

Compute a set of views eagerly (inside freeze() through FreezeOptions.prepare, or off the critical path).

Parameters ​

views ​

readonly ViewName[]

the views to materialise

Returns ​

this

this snapshot

Implementation of ​

GraphSnapshotContract.prepare


relabel() ​

relabel(perm): DerivedGraph

Defined in: graph-format/dist/src/snapshot/graph-snapshot.d.ts:350

Permute the node space: perm[newIndex] = oldIndex; the id map follows; edge order is preserved.

Parameters ​

perm ​

U32

a permutation of 0..n-1; E_INVALID_PERMUTATION otherwise

Returns ​

DerivedGraph

the derived graph

Implementation of ​

GraphSnapshotContract.relabel


reverse() ​

reverse(): ReverseView

Defined in: graph-format/dist/src/snapshot/graph-snapshot.d.ts:183

The in-adjacency, rows sorted by source; the forward arrays themselves when undirected. Cached and shared.

Returns ​

ReverseView

the reverse view

Implementation of ​

GraphSnapshotContract.reverse


seal() ​

seal(): void

Defined in: graph-format/dist/src/snapshot/graph-snapshot.d.ts:359

Make the column SET of every attribute table (nodes, edges, graph and each extension table) read-only: from then on set(), remove() and rename() on those tables throw E_FROZEN. Reads are unchanged, and so is the CONTENT of columns declared mutable. A table object shared with another snapshot (a derived graph shares tables; withColumns() shares the extension tables) is sealed for that snapshot too; withColumns() on a sealed snapshot returns writable node, edge and graph tables. Idempotent; there is no unseal.

Returns ​

void

Implementation of ​

GraphSnapshotContract.seal


selfLoopArcs() ​

selfLoopArcs(): U32

Defined in: graph-format/dist/src/snapshot/graph-snapshot.d.ts:247

The arcs a with colIdx[a] === row(a), found by binary search per row. Cached and shared: call .slice() before writing.

Returns ​

U32

Uint32Array(selfLoopCount)

Implementation of ​

GraphSnapshotContract.selfLoopArcs


selfLoopsAt() ​

selfLoopsAt(u): number

Defined in: graph-format/dist/src/snapshot/graph-snapshot.d.ts:258

Point query: self-loop arcs at one node, O(log d).

Parameters ​

u ​

number

the node index

Returns ​

number

the count

Implementation of ​

GraphSnapshotContract.selfLoopsAt


selfLoopsPerNode() ​

selfLoopsPerNode(): U32

Defined in: graph-format/dist/src/snapshot/graph-snapshot.d.ts:252

Self-loop arcs per node. Cached and shared: call .slice() before writing.

Returns ​

U32

Uint32Array(n)

Implementation of ​

GraphSnapshotContract.selfLoopsPerNode


selfLoopWeight() ​

selfLoopWeight(): F64

Defined in: graph-format/dist/src/snapshot/graph-snapshot.d.ts:236

Sum of weights over each node's self-loop arcs (selfLoopsPerNode widened when unweighted). Cached and shared: call .slice() before writing.

Returns ​

F64

Float64Array(n)

Implementation of ​

GraphSnapshotContract.selfLoopWeight


simplified() ​

simplified(options?): DerivedGraph

Defined in: graph-format/dist/src/snapshot/graph-snapshot.d.ts:316

One edge per (u, v) group (parallels are adjacent by invariant I4), survivor = lowest index; flags.multigraph is false afterwards.

Parameters ​

options? ​

SimplifyOptions

reducers and self-loop policy

Returns ​

DerivedGraph

the derived graph

Implementation of ​

GraphSnapshotContract.simplified


toByteChunks() ​

toByteChunks(options?): Iterable<U8>

Defined in: graph-format/dist/src/snapshot/graph-snapshot.d.ts:408

The GSNP container as a sequence of chunks (design section 9.2): the header plus manifest, then one chunk per non-empty segment.

Parameters ​

options? ​

ToBytesOptions

views to include

Returns ​

Iterable<U8>

the chunks

Implementation of ​

GraphSnapshotContract.toByteChunks


toBytes() ​

toBytes(options?): U8

Defined in: graph-format/dist/src/snapshot/graph-snapshot.d.ts:401

The GSNP byte container as one contiguous buffer (design section 9.2).

Parameters ​

options? ​

ToBytesOptions

views to include

Returns ​

U8

the container bytes

Implementation of ​

GraphSnapshotContract.toBytes


totalWeight() ​

totalWeight(): number

Defined in: graph-format/dist/src/snapshot/graph-snapshot.d.ts:241

Sum of weights over logical edges (each undirected edge once). Cached.

Returns ​

number

the total weight

Implementation of ​

GraphSnapshotContract.totalWeight


toUndirected() ​

toUndirected(options?): DerivedGraph

Defined in: graph-format/dist/src/snapshot/graph-snapshot.d.ts:303

Every directed edge becomes undirected; reciprocal pairs collapse to one edge keeping the lower index's row (keep-first). Returns { snapshot: this, null maps } on an undirected snapshot.

Parameters ​

options? ​

ToUndirectedOptions

reciprocal filtering and the weight reducer

Returns ​

DerivedGraph

the derived graph

Implementation of ​

GraphSnapshotContract.toUndirected


toWire() ​

toWire(options?): WireSnapshot

Defined in: graph-format/dist/src/snapshot/graph-snapshot.d.ts:395

The plain-object wire form (design section 9.1): a JSON-serialisable manifest plus the backing buffers. With transfer: true only exclusively owned buffers are listed as transferables and shared ones are copied.

Parameters ​

options? ​

ToWireOptions

transfer mode, views and columns to include

Returns ​

WireSnapshot

the wire snapshot

Implementation of ​

GraphSnapshotContract.toWire


transferables() ​

transferables(): ArrayBuffer[]

Defined in: graph-format/dist/src/snapshot/graph-snapshot.d.ts:387

The distinct, exclusively owned backing buffers: the postMessage transfer list (design section 9.1). Buffers shared with another holder (a withColumns() sibling, a derived graph sharing the node table) are excluded.

Returns ​

ArrayBuffer[]

the buffers

Implementation of ​

GraphSnapshotContract.transferables


transpose() ​

transpose(): DerivedGraph

Defined in: graph-format/dist/src/snapshot/graph-snapshot.d.ts:309

Orientation of every edge swapped: the reverse view's arrays become the core. Returns this on an undirected snapshot.

Returns ​

DerivedGraph

the derived graph (same node and edge spaces)

Implementation of ​

GraphSnapshotContract.transpose


validate() ​

validate(options?): void

Defined in: graph-format/dist/src/snapshot/graph-snapshot.d.ts:417

Check the invariants (design section 11.4): the recorded checksums first when checksum is set (a mutated frozen array is the most useful diagnosis, details.reason "checksum"; "no-checksum" when none were recorded), then "structure" or "full" (default) per the level table of design section 9.5. Throws E_INVALID_SNAPSHOT with details.invariant and the location on the first violation.

Parameters ​

options? ​

ValidateOptions

level and checksum comparison

Returns ​

void

Implementation of ​

GraphSnapshotContract.validate


weightedDegree() ​

weightedDegree(): F64

Defined in: graph-format/dist/src/snapshot/graph-snapshot.d.ts:230

NetworkX weighted degree: weightedOutDegree + (directed ? weightedInDegree : selfLoopWeight), so the sum is 2 * totalWeight() when undirected. Cached and shared: call .slice() before writing.

Returns ​

F64

Float64Array(n)

Implementation of ​

GraphSnapshotContract.weightedDegree


weightedInDegree() ​

weightedInDegree(): F64

Defined in: graph-format/dist/src/snapshot/graph-snapshot.d.ts:224

Weight sums over incoming arcs; the same object as weightedOutDegree() when undirected. Cached and shared: call .slice() before writing.

Returns ​

F64

Float64Array(n)

Implementation of ​

GraphSnapshotContract.weightedInDegree


weightedOutDegree() ​

weightedOutDegree(): F64

Defined in: graph-format/dist/src/snapshot/graph-snapshot.d.ts:218

Row sums of weights (a self-loop arc counted once); outDegree widened when unweighted. F64 for CPU precision; may be 0 for a node with out-arcs. Cached and shared: call .slice() before writing.

Returns ​

F64

Float64Array(n)

Implementation of ​

GraphSnapshotContract.weightedOutDegree


withColumns() ​

withColumns(nodes?, edges?): GraphSnapshot

Defined in: graph-format/dist/src/snapshot/graph-snapshot.d.ts:367

A new snapshot object sharing the core, the id map and the serial with a CLONED column set plus the given columns (the only operation that clones the column set).

Parameters ​

nodes? ​

Readonly<Record<string, TypedArrayData | ColumnInput>>

node columns to add, keyed by name

edges? ​

Readonly<Record<string, TypedArrayData | ColumnInput>>

edge columns to add, keyed by name

Returns ​

GraphSnapshot

the new snapshot

Implementation of ​

GraphSnapshotContract.withColumns


withoutSelfLoops() ​

withoutSelfLoops(): DerivedGraph

Defined in: graph-format/dist/src/snapshot/graph-snapshot.d.ts:321

Every edge with source !== target.

Returns ​

DerivedGraph

the derived graph

Implementation of ​

GraphSnapshotContract.withoutSelfLoops