pub fn reachable<P>(&self, start: (usize, usize), mut predicate: P) -> BTreeSet<(usize, usize)>
    where
        P: FnMut((usize, usize)) -> bool + Copy,
    {
        bfs_reach(start, |&n| {
            self.neighbours(n)
                .into_iter()
                .filter(move |&n| predicate(n))
        })
        .collect()
    }
/// Return a set of the indices reachable from a candidate starting point
/// and for which the given predicate is valid. This can be used for example
/// to implement a flood-filling algorithm. Since the indices are collected
/// into a vector, they can later be used without keeping a reference on the
/// matrix itself, e.g., to modify the grid.
Return a set of the indices reachable from a candidate starting point
and for which the given predicate is valid. This can be used for example
to implement a flood-filling algorithm. Since the indices are collected
into a vector, they can later be used without keeping a reference on the
matrix itself, e.g., to modify the grid.
Return a set of the indices reachable from a candidate starting point and for which the given predicate is valid . This can be used for example to implement a flood - filling algorithm . Since the indices are collected into a vector they can later be used without keeping a reference on the matrix itself e . g . to modify the grid .
pub fn reachable<P>(&self, start: (usize, usize), mut predicate: P) -> BTreeSet<(usize, usize)>
    where
        P: FnMut((usize, usize)) -> bool + Copy,
    {
        bfs_reach(start, |&n| {
            self.neighbours(n)
                .into_iter()
                .filter(move |&n| predicate(n))
        })
        .collect()
    }
pub fn reachable < P > ( & self , start : ( usize , usize ) , mut predicate : P ) -> BTreeSet < ( usize , usize ) > where P : FnMut ( ( usize , usize ) ) -> bool + Copy , { bfs_reach ( start , | & n | { self . neighbours ( n ) . into_iter ( ) . filter ( move | & n | predicate ( n ) ) } ) . collect ( ) }
Return a set of the indices reachable from a candidate starting point
and for which the given predicate is valid.
Return a set of the indices reachable from a candidate starting point and for which the given predicate is valid .
&self
start
(usize, usize)
predicate
P
&self
start
(usize, usize)
predicate
P