Graph.addVertex() method
Adds vertices with no edges.
Signature:
addVertex(...vertex: T[]): Graph<T>;
Parameters
|
Parameter |
Type |
Description |
|---|---|---|
|
vertex |
T[] |
Vertices to add. |
Returns:
Graph<T>
This graph, for chaining.
Remarks
Not idempotent: a vertex that is already present has its edges RESET, so guard with Graph.hasVertex() when a vertex may already be there. Adding an edge from an unknown vertex adds it for you, which is the usual way one appears.