Generalized the shortestPath function. Search now runs maxSteps iterations.