// codesnip-guard: RhoPath #[cfg_attr(any(),rustfmt::skip)]pub use self::rho_path::RhoPath;#[cfg_attr(any(),rustfmt::skip)]mod rho_path{use std::{collections::HashMap,hash::Hash};#[doc=" $P_0 =$ `init`, $P_{i+1} = next(P_i)$"]#[doc=""]#[doc=" if |T| is finite then P = f, g, g, ..."]#[derive(Debug)]pub struct RhoPath{pub f:Vec,pub g:Vec}implRhoPath{#[doc=" build rho path"]pub fn build(init:T,next:F)->Self where T:Clone+Eq+Hash,F:Fn(&T)->T{let mut path=vec![init.clone()];let mut visited=HashMap::new();visited.insert(init,0);let loop_start=loop{let next_val=next(path.last().unwrap());if let Some(&idx)=visited.get(&next_val){break idx;}let cnt=path.len();path.push(next_val.clone());visited.insert(next_val,cnt);};let looped=path.split_off(loop_start);Self{f:path,g:looped}}#[doc=" rho path that index of rho path"]pub fn build_rho(&self,init:usize,next:F)->RhoPathwhere F:Fn(&usize)->usize{let(n,m)=(self.f.len(),self.g.len());RhoPath::build(init,|x|{let y=next(x);if y&T{if index