Home > @jsplumbtoolkit/core > Graph > getDistance
Graph.getDistance() method
Finds the distance between source and target.
Signature:
getDistance(source: Vertex, target: Vertex, strict?: boolean): number;
Parameters
Parameter | Type | Description |
---|---|---|
source | Vertex | Source vertex or vertex ID. |
target | Vertex | Target vertex or vertex ID. |
strict | boolean | Defauls to true. Sets whether or not paths are searched strictly by the given source/target. If, for instance, you supply a node as the source, but there are only edges connected to ports on that node, by default these edges will be ignored. Switching strict to false will mean these edges are considered. |
Returns:
number
Distance from the source to the target.