Allow algorithm to return infinity for paths that are not found