Add a max_path parameter to limit combinatorial path lengths.