pub fn find_circuit(mut self, graph: &G) -> Result<Vec<usize>> {
        // If graph has only one vertex, that single vertex is an Eulerian circuit.
        if self.out_deg.len() <= 1 {
            return Ok(self.trail);
        }
        let circuit_start_id = self.start_of_eulerian_circuit();

        // If there is no suitable id to start the search from, graph does not have Eulerian circuit.
        if circuit_start_id.is_none() {
            Err(Error::new_ecnf())?
        }

        // Make sure graph has at least one edge to traverse.
        if !self.unused_edges.is_empty() {
            self.rec_execute(graph, circuit_start_id.unwrap());
        }

        // Trail actually has the visited vertices in the backward order. So first visited vertex is the last item in the `trail` structure.
        // So for trail to make sense to the user, reverse it before returning it so that first visited vertex is also the first item in the structure.
        self.trail.reverse();

        Ok(self.trail)
    }
/// Finds the Eulerian circuit if there is one.
///
/// # Arguments
/// `graph`: Graph to search the eulerian circuit in it.
///
/// # Returns
/// * `Ok`: Containing list of vector ids that will get visited during the eulerian circuit.
/// * `Err`: If graph does not have Eulerian circuit.
Finds the Eulerian circuit if there is one.
Finds the Eulerian circuit if there is one .
pub fn find_circuit(mut self, graph: &G) -> Result<Vec<usize>> {
        // If graph has only one vertex, that single vertex is an Eulerian circuit.
        if self.out_deg.len() <= 1 {
            return Ok(self.trail);
        }
        let circuit_start_id = self.start_of_eulerian_circuit();
        // If there is no suitable id to start the search from, graph does not have Eulerian circuit.
        if circuit_start_id.is_none() {
            Err(Error::new_ecnf())?
        }
        // Make sure graph has at least one edge to traverse.
        if !self.unused_edges.is_empty() {
            self.rec_execute(graph, circuit_start_id.unwrap());
        }
        // Trail actually has the visited vertices in the backward order. So first visited vertex is the last item in the `trail` structure.
        // So for trail to make sense to the user, reverse it before returning it so that first visited vertex is also the first item in the structure.
        self.trail.reverse();
        Ok(self.trail)
    }
pub fn find_circuit ( mut self , graph : & G ) -> Result < Vec < usize > > { // If graph has only one vertex, that single vertex is an Eulerian circuit. if self . out_deg . len ( ) <= 1 { return Ok ( self . trail ) ; } let circuit_start_id = self . start_of_eulerian_circuit ( ) ; // If there is no suitable id to start the search from, graph does not have Eulerian circuit. if circuit_start_id . is_none ( ) { Err ( Error :: new_ecnf ( ) ) ? } // Make sure graph has at least one edge to traverse. if ! self . unused_edges . is_empty ( ) { self . rec_execute ( graph , circuit_start_id . unwrap ( ) ) ; } // Trail actually has the visited vertices in the backward order. So first visited vertex is the last item in the `trail` structure. // So for trail to make sense to the user, reverse it before returning it so that first visited vertex is also the first item in the structure. self . trail . reverse ( ) ; Ok ( self . trail ) }
Finds the Eulerian circuit if there is one.
Finds the Eulerian circuit if there is one .
mut self
graph
&G
`Ok`: Containing list of vector ids that will get visited during the eulerian circuit.
`Err`: If graph does not have Eulerian circuit.
` Ok ` : Containing list of vector ids that will get visited during the eulerian circuit . ` Err ` : If graph does not have Eulerian circuit .
mut self
graph
&G