hasEdge method

bool hasEdge(
  1. int from,
  2. int to
)

Return true if the graph has an edge connecting the given from and to node indices.

Implementation

bool hasEdge(int from, int to ) {
	if ( hasNode( from ) && hasNode( to ) ) {
		final edges = _edges[from];

		for ( int i = 0, l = (edges?.length ?? 0); i < l; i ++ ) {
			final edge = edges![ i ];

			if ( edge.to == to ) {
				return true;
			}
		}

		return false;
	}
    else {
		return false;
	}
}