Function advent_of_code_2021::day_12::build_paths[−][src]

fn build_paths<'a>(caves: &Vec<Cave>, can_revisit: bool) -> Vec<Path>ⓘ
Notable traits for Vec<u8, A>
impl<A> Write for Vec<u8, A> where
    A: Allocator, 
Expand description

Find the start and end indices, initialise a single path at the start position, and an empty list of complete paths. Take nodes from the stack, iterating through the linked caves and pushing all valid new paths back onto the stack (if incomplete) or into the list of complete paths if their updated position is the end node, repeat until the stack is exhausted and return the completed path.