function visit( i ) {
		var err;
		var j;

		// Check if we've already processed/visited this vertex...
		if ( marks[ i ] === 2 ) {
			return 0;
		}
		// Check if we've seen this vertex before and the vertex is still being processed...
		if ( marks[ i ] === 1 ) {
			// We've found a cycle...
			return -1;
		}
		// Mark the current vertex as currently being processed:
		marks[ i ] = 1;

		// Follow all edges from the current vertex...
		for ( j = 0; j < N; j++ ) {
			idx = self._loc( i, j, idx ); // eslint-disable-line no-underscore-dangle
			if ( isSet( self._buffer[ idx[0] ], idx[1] ) ) { // eslint-disable-line no-underscore-dangle
				err = visit( j );
				if ( err !== 0 ) {
					// This vertex is part of a cycle, so add to cycle stack...
					s.push( j );
					return err;
				}
			}
		}
		// Mark the current vertex as processed:
		marks[ i ] = 2;

		// Add to the output array now that all subsequent vertices (relative to this vertex) in the graph have already been added to the output array:
		out.push( i );

		return 0;
	}
Visits a graph vertex and follows edges until finding a leaf vertex (if one exists).

## Notes

-   If the function is able to successfully perform a depth-first-search, the functions returns `0`; otherwise, the function returns `-1` in the event of a cycle.

@private
@param {NonNegativeInteger} i - vertex
@returns {integer} error code