pub fn is_compressed<S: CompressionSpec<D>>(&self, spec: &S) -> Option<(usize, usize)> {
        for i in 0..self.len() {
            let n = self.get_node(i);

            for dir in vec![Dir::Left, Dir::Right] {
                let dir_edges = n.edges(dir);
                if dir_edges.len() == 1 {
                    let (next_id, return_dir, _) = dir_edges[0];
                    let next = self.get_node(next_id);

                    let ret_edges = next.edges(return_dir);
                    if ret_edges.len() == 1 {
                        // Test for us being a palindrome: this makes it OK
                        if n.len() == K::k() && n.sequence().first_kmer::<K>().is_palindrome() {
                            continue;
                        }

                        // Test for a neighbor being a palindrome: this makes it OK
                        if next.len() == K::k() && next.sequence().first_kmer::<K>().is_palindrome()
                        {
                            continue;
                        }

                        // Test for this edge representing a smooth circle (biting it's own tail):
                        if n.node_id == next_id {
                            continue;
                        }

                        if spec.join_test(n.data(), next.data()) {
                            // Found a unbranched edge that should have been eliminated
                            return Some((i, next_id));
                        }
                    }
                }
            }
        }

        None
    }
/// Check whether the graph is fully compressed. Return `None` if it's compressed,
/// otherwise return `Some(node1, node2)` representing a pair of node that could
/// be collapsed. Probably only useful for testing.
Check whether the graph is fully compressed. Return `None` if it's compressed,
otherwise return `Some(node1, node2)` representing a pair of node that could
be collapsed. Probably only useful for testing.
Check whether the graph is fully compressed . Return ` None ` if it ' s compressed otherwise return ` Some ( node1 node2 ) ` representing a pair of node that could be collapsed . Probably only useful for testing .
pub fn is_compressed<S: CompressionSpec<D>>(&self, spec: &S) -> Option<(usize, usize)> {
        for i in 0..self.len() {
            let n = self.get_node(i);
            for dir in vec![Dir::Left, Dir::Right] {
                let dir_edges = n.edges(dir);
                if dir_edges.len() == 1 {
                    let (next_id, return_dir, _) = dir_edges[0];
                    let next = self.get_node(next_id);
                    let ret_edges = next.edges(return_dir);
                    if ret_edges.len() == 1 {
                        // Test for us being a palindrome: this makes it OK
                        if n.len() == K::k() && n.sequence().first_kmer::<K>().is_palindrome() {
                            continue;
                        }
                        // Test for a neighbor being a palindrome: this makes it OK
                        if next.len() == K::k() && next.sequence().first_kmer::<K>().is_palindrome()
                        {
                            continue;
                        }
                        // Test for this edge representing a smooth circle (biting it's own tail):
                        if n.node_id == next_id {
                            continue;
                        }
                        if spec.join_test(n.data(), next.data()) {
                            // Found a unbranched edge that should have been eliminated
                            return Some((i, next_id));
                        }
                    }
                }
            }
        }
        None
    }
pub fn is_compressed < S : CompressionSpec < D > > ( & self , spec : & S ) -> Option < ( usize , usize ) > { for i in 0 .. self . len ( ) { let n = self . get_node ( i ) ; for dir in vec ! [ Dir Left Dir Right ] { let dir_edges = n . edges ( dir ) ; if dir_edges . len ( ) == 1 { let ( next_id , return_dir , _ ) = dir_edges [ 0 ] ; let next = self . get_node ( next_id ) ; let ret_edges = next . edges ( return_dir ) ; if ret_edges . len ( ) == 1 { // Test for us being a palindrome: this makes it OK if n . len ( ) == K :: k ( ) && n . sequence ( ) . first_kmer :: < K > ( ) . is_palindrome ( ) { continue ; } // Test for a neighbor being a palindrome: this makes it OK if next . len ( ) == K :: k ( ) && next . sequence ( ) . first_kmer :: < K > ( ) . is_palindrome ( ) { continue ; } // Test for this edge representing a smooth circle (biting it's own tail): if n . node_id == next_id { continue ; } if spec . join_test ( n . data ( ) , next . data ( ) ) { // Found a unbranched edge that should have been eliminated return Some ( ( i , next_id ) ) ; } } } } } None }
Check whether the graph is fully compressed.
Check whether the graph is fully compressed .
&self
spec
&S
&self
spec
&S