Function aoc::year2023::day23::dfs

source ยท
fn dfs(input: &Input, state: &mut State, row: usize, col: usize, steps: u32)
Expand description

Modified depth first search that only allows paths that skip one node.

For a 6x6 grid there are 1262816 total possible rook walks (given by OEIS A007764).

However since we want the longest path it only makes sense to consider the paths that visit the most possible nodes. There are only 10180 of these paths making it much faster.