pub fn start_of_eulerian_trail(&self) -> Option<usize> {
        let has_trail = if Ty::is_undirected() {
            // An undirected graph has an Eulerian trail if and only if exactly zero or two vertices have odd degree.
            let num_of_odd_degrees = self
                .in_deg
                .iter()
                .filter(|in_deg| (**in_deg % 2) != 0)
                .count();
            num_of_odd_degrees == 0 || num_of_odd_degrees == 2
        } else {
            // A directed graph has an Eulerian trail if and only if at most one vertex has (out-degree) − (in-degree) = 1
            let pos_diff = self.diff_deg.iter().filter(|diff| **diff == 1).count();

            pos_diff == 1 || pos_diff == 0
        };

        has_trail.then(|| self.find_start_virt_id()).flatten()
    }
/// Finds id of the vertex to start the Eulerian trail from.
///
/// # Returns
/// * `Some`: Containing the id of the starting vertex of Eulerian trail.
/// * `None`: If can not find a starting vertex for Eulerian trail.
Finds id of the vertex to start the Eulerian trail from.
Finds id of the vertex to start the Eulerian trail from .
pub fn start_of_eulerian_trail(&self) -> Option<usize> {
        let has_trail = if Ty::is_undirected() {
            // An undirected graph has an Eulerian trail if and only if exactly zero or two vertices have odd degree.
            let num_of_odd_degrees = self
                .in_deg
                .iter()
                .filter(|in_deg| (**in_deg % 2) != 0)
                .count();
            num_of_odd_degrees == 0 || num_of_odd_degrees == 2
        } else {
            // A directed graph has an Eulerian trail if and only if at most one vertex has (out-degree) − (in-degree) = 1
            let pos_diff = self.diff_deg.iter().filter(|diff| **diff == 1).count();
            pos_diff == 1 || pos_diff == 0
        };
        has_trail.then(|| self.find_start_virt_id()).flatten()
    }
pub fn start_of_eulerian_trail ( & self ) -> Option < usize > { let has_trail = if Ty :: is_undirected ( ) { // An undirected graph has an Eulerian trail if and only if exactly zero or two vertices have odd degree. let num_of_odd_degrees = self . in_deg . iter ( ) . filter ( | in_deg | ( * * in_deg % 2 ) != 0 ) . count ( ) ; num_of_odd_degrees == 0 || num_of_odd_degrees == 2 } else { // A directed graph has an Eulerian trail if and only if at most one vertex has (out-degree) − (in-degree) = 1 let pos_diff = self . diff_deg . iter ( ) . filter ( | diff | * * diff == 1 ) . count ( ) ; pos_diff == 1 || pos_diff == 0 } ; has_trail . then ( | | self . find_start_virt_id ( ) ) . flatten ( ) }
Finds id of the vertex to start the Eulerian trail from.
Finds id of the vertex to start the Eulerian trail from .
&self
`Some`: Containing the id of the starting vertex of Eulerian trail.
`None`: If can not find a starting vertex for Eulerian trail.
` Some ` : Containing the id of the starting vertex of Eulerian trail . ` None ` : If can not find a starting vertex for Eulerian trail .
&self