pub fn consensus(&mut self, params : &Params) -> (Vec<u64>, Vec<String>) {
        let debug = params.debug; // prints POA graph in dot format

        let mut cns = Vec::new();
        let mut cns_edges_seqs = Vec::new();
        let nodes = self.consensus_path(&params).to_vec();
        for i in 0..(nodes.len())
        {
            cns.push(*self.graph.node_weight(nodes[i]).unwrap() as u64);
            if i < nodes.len()-1
            {
                let edge = self.graph.find_edge(nodes[i],nodes[i+1]).unwrap();
                cns_edges_seqs.push(self.graph.edge_weight(edge).unwrap().1.clone());
            }
        }
        //println!("[in poa] consensus()/consensus_edge_seqs() lens: {} / {}", cns.len(), cns_edges_seqs.len());

        if debug 
        {
            // debug: print graph in dot format
            let printable_graph = self.graph.filter_map(|_, w| Some(format!("{:?}", w)), |_, w| if w.0 > 1 { Some(format!("{:?}", w.0))} else {None});
            println!("{}", Dot::with_config(&printable_graph, &[]));
        }

        (cns.to_vec(), cns_edges_seqs.to_vec())
    }
/// return the consensus of the POA
/// and also
/// return the sequences associated to edges in the consensus
return the consensus of the POA
and also
return the sequences associated to edges in the consensus
return the consensus of the POA and also return the sequences associated to edges in the consensus
pub fn consensus(&mut self, params : &Params) -> (Vec<u64>, Vec<String>) {
        let debug = params.debug; // prints POA graph in dot format
        let mut cns = Vec::new();
        let mut cns_edges_seqs = Vec::new();
        let nodes = self.consensus_path(&params).to_vec();
        for i in 0..(nodes.len())
        {
            cns.push(*self.graph.node_weight(nodes[i]).unwrap() as u64);
            if i < nodes.len()-1
            {
                let edge = self.graph.find_edge(nodes[i],nodes[i+1]).unwrap();
                cns_edges_seqs.push(self.graph.edge_weight(edge).unwrap().1.clone());
            }
        }
        //println!("[in poa] consensus()/consensus_edge_seqs() lens: {} / {}", cns.len(), cns_edges_seqs.len());
        if debug 
        {
            // debug: print graph in dot format
            let printable_graph = self.graph.filter_map(|_, w| Some(format!("{:?}", w)), |_, w| if w.0 > 1 { Some(format!("{:?}", w.0))} else {None});
            println!("{}", Dot::with_config(&printable_graph, &[]));
        }
        (cns.to_vec(), cns_edges_seqs.to_vec())
    }
pub fn consensus ( & mut self , params : & Params ) -> ( Vec < u64 > , Vec < String > ) { let debug = params . debug ; // prints POA graph in dot format let mut cns = Vec :: new ( ) ; let mut cns_edges_seqs = Vec :: new ( ) ; let nodes = self . consensus_path ( & params ) . to_vec ( ) ; for i in 0 .. ( nodes . len ( ) ) { cns . push ( * self . graph . node_weight ( nodes [ i ] ) . unwrap ( ) as u64 ) ; if i < nodes . len ( ) - 1 { let edge = self . graph . find_edge ( nodes [ i ] , nodes [ i + 1 ] ) . unwrap ( ) ; cns_edges_seqs . push ( self . graph . edge_weight ( edge ) . unwrap ( ) . 1 . clone ( ) ) ; } } //println!("[in poa] consensus()/consensus_edge_seqs() lens: {} / {}", cns.len(), cns_edges_seqs.len()); if debug { // debug: print graph in dot format let printable_graph = self . graph . filter_map ( | _ , w | Some ( format ! ( " " w ) ) , | _ , w | if w . 0 > 1 { Some ( format ! ( " " w 0 ) ) } else { None } ) ; println ! ( " " Dot with_config ( printable_graph [ ] ) ) ; } ( cns . to_vec ( ) , cns_edges_seqs . to_vec ( ) ) }
return the consensus of the POA
and also
return the sequences associated to edges in the consensus
return the consensus of the POA and also return the sequences associated to edges in the consensus
&mut self
params
&Params
&mut self
params
&Params