AbstractVertex value type.
Edge value type.
Concrete vertex subclass (extends AbstractVertex
Concrete edge subclass (extends AbstractEdge
Construct a graph with runtime defaults.
Optionaloptions: Partial<Record<string, unknown>>GraphOptions<V> in options.graph (e.g. vertexValueInitializer, defaultEdgeWeight).
Protected Abstract_addInternal hook to attach an edge into adjacency structures.
Edge instance.
true if inserted; otherwise false.
Protected_addInsert a pre-built vertex into the graph.
Concrete vertex instance.
true if inserted; false if key already exists.
Protected_createProtected_createCreate a same-species graph populated with entries; preserves edges among kept vertices.
Optionaliter: Iterable<[VertexKey, undefined | V], any, any>Optional entries to seed the new graph.
Optionaloptions: Partial<Record<string, unknown>>Snapshot options.
A new graph of this type.
Protected_getProtected_getProtected_getResolve a vertex key from a key or vertex instance.
Vertex key or existing vertex.
The vertex key.
Protected_snapshotBellman-Ford single-source shortest paths with option to scan negative cycles.
Source vertex or key.
OptionalscanNegativeCycle: booleanIf true, also detect negative cycles.
OptionalgetMin: booleanIf true, compute global minimum distance.
OptionalgenPath: booleanIf true, generate path arrays via predecessor map.
Result bag including distances, predecessors, and optional cycle flag.
AbstractclearAbstractcreateCreate a new edge instance (implementation specific).
Source/endpoint A key.
Destination/endpoint B key.
Optionalweight: numberEdge weight (defaults may apply).
Optionalvalue: EEdge payload.
Concrete edge instance.
AbstractcreateAbstractdegreeDegree of a vertex in this graph model.
Vertex or key.
Non-negative integer degree.
AbstractdeleteAbstractdeleteDelete a vertex and its incident edges.
Vertex or key.
true if removed; otherwise false.
AbstractedgeAbstractedgesTest whether all entries satisfy the predicate.
(key, value, index, self) => boolean.
OptionalthisArg: anyOptional this for callback.
true if all pass; otherwise false.
Induced-subgraph filter: keep vertices where predicate(key, value) is true,
and only keep edges whose endpoints both survive.
(key, value, index, self) => boolean.
OptionalthisArg: anyOptional this for callback.
A new graph of the same concrete class (this type).
Find the first entry that matches a predicate.
(key, value, index, self) => boolean.
OptionalthisArg: anyOptional this for callback.
Matching [key, value] or undefined.
Visit each entry, left-to-right.
(key, value, index, self) => void.
OptionalthisArg: anyOptional this for callback.
AbstractgetAbstractgetAbstractgetSum the weights along a vertex path.
Sequence of vertices.
Path weight sum (0 if empty or edge missing).
Whether there exists an entry with the given value.
Value to test.
true if found; otherwise false.
Whether a vertex exists.
Vertex or key.
true if present, otherwise false.
AbstractisDelete multiple vertices.
Array of vertices or keys.
true if any vertex was removed.
Test whether any entry satisfies the predicate.
(key, value, index, self) => boolean.
OptionalthisArg: anyOptional this for callback.
true if any passes; otherwise false.
Abstract graph over vertices and edges.
Remarks
Time O(1), Space O(1)
Example