Initializing number of edges traversed to maximum value