Less than 1 minute
Home > @hz-9/algorithm > Graph > hasEdge
Graph.hasEdge() method
Check if an edge exists in the graph.
检查边是否存在于图中。
Signature:
hasEdge(fromVertex: T | Vertice<T>, toVertex: T | Vertice<T>): boolean;Parameters
Parameter | Type | Description |
|---|---|---|
fromVertex | T | Vertice<T> | The first vertex of the edge. (If the graph is directed, the order of vertices matters.) |
toVertex | T | Vertice<T> | The second vertex of the edge. |
Returns:
boolean
Whether the edge exists.