Graph.addEdge() method
Adds edges from one vertex to others.
Signature:
addEdge(fromVertex: T, ...toVertex: T[]): Graph<T>;
Parameters
|
Parameter |
Type |
Description |
|---|---|---|
|
fromVertex |
T |
Vertex the edges start from. |
|
toVertex |
T[] |
Vertices they point at. |
Returns:
Graph<T>
This graph, for chaining.
Remarks
Directed: only fromVertex records them. It is added to the graph first if it is not there yet, while the targets are not — an edge may point at a vertex the graph does not otherwise know. Duplicate edges are kept as duplicates.