whenever you want to put a complete path into the vector, check the vector, and decide whether to discard the "path" in the vector(when it is longer than new path) or not put the new path(when it is longer than the path in the vector) into the vector.