/// Find cycles that the two specified vertices belong to.
Find cycles that the two specified vertices belong to.
Find cycles that the two specified vertices belong to .
pub fn find_cycle_for_vertices<T: graph::Vertex>(
    vertice_idx_1: usize,
    vertice_idx_2: usize,
    vv: &graph::VertexVec<T>,
    max_steps: usize
) -> Option<Vec<usize>> {
    let mut open_routes: Vec<Vec<usize>> = vec![vec![vertice_idx_1]];
    let mut cyclic_routes: Vec<Vec<usize>> = vec![];
    for _ in 0..max_steps {
        let open_routes_tmp = open_routes.clone();
        open_routes.clear();
        for route in open_routes_tmp.iter() {
            extend_one_edge(route, vv, &mut cyclic_routes, &mut open_routes);
        }
    } 
    cyclic_routes.sort_by_key(|r| r.len());
    for route in cyclic_routes.iter() {
        if route.contains(&vertice_idx_2) {
            return Some(route.clone())
        }
    }
    return None
}
pub fn find_cycle_for_vertices < T : graph :: Vertex > ( vertice_idx_1 : usize , vertice_idx_2 : usize , vv : & graph :: VertexVec < T > , max_steps : usize ) -> Option < Vec < usize > > { let mut open_routes : Vec < Vec < usize > > = vec ! [ vec [ vertice_idx_1 ] ] ; let mut cyclic_routes : Vec < Vec < usize > > = vec ! [ ] ; for _ in 0 .. max_steps { let open_routes_tmp = open_routes . clone ( ) ; open_routes . clear ( ) ; for route in open_routes_tmp . iter ( ) { extend_one_edge ( route , vv , & mut cyclic_routes , & mut open_routes ) ; } } cyclic_routes . sort_by_key ( | r | r . len ( ) ) ; for route in cyclic_routes . iter ( ) { if route . contains ( & vertice_idx_2 ) { return Some ( route . clone ( ) ) } } return None }
Find cycles that the two specified vertices belong to.
Find cycles that the two specified vertices belong to .
vertice_idx_1
usize
vertice_idx_2
usize
vv
&graph::VertexVec<T>
max_steps
usize