pub fn find_affected_nodes_per_node(fbas: &Fbas) -> Vec<NodeIdSet> {
    let mut result: Vec<NodeIdSet> = (0..fbas.number_of_nodes())
        .map(|node_id| bitset! {node_id})
        .collect();
    let mut this_visit = NodeIdSet::new();
    let mut next_visit = fbas.all_nodes();
    let mut tmp = NodeIdSet::new(); // for fewer memory allocations
    while !next_visit.is_empty() {
        this_visit.clear();
        this_visit.union_with(&next_visit);
        next_visit.clear();
        for affected_node in this_visit.iter() {
            for affecting_node in fbas.nodes[affected_node]
                .quorum_set
                .contained_nodes()
                .iter()
            {
                tmp.clear();
                tmp.union_with(&result[affected_node]);
                if !result[affecting_node].is_superset(&tmp) {
                    result[affecting_node].union_with(&tmp);
                    next_visit.insert(affecting_node);
                }
            }
        }
    }
    result
}
/// Find nodes that are affected by each node v, i.e., that point to v after a few steps; nodes
/// also affect themselves.
Find nodes that are affected by each node v, i.e., that point to v after a few steps; nodes
also affect themselves.
Find nodes that are affected by each node v i . e . that point to v after a few steps ; nodes also affect themselves .
pub fn find_affected_nodes_per_node(fbas: &Fbas) -> Vec<NodeIdSet> {
    let mut result: Vec<NodeIdSet> = (0..fbas.number_of_nodes())
        .map(|node_id| bitset! {node_id})
        .collect();
    let mut this_visit = NodeIdSet::new();
    let mut next_visit = fbas.all_nodes();
    let mut tmp = NodeIdSet::new(); // for fewer memory allocations
    while !next_visit.is_empty() {
        this_visit.clear();
        this_visit.union_with(&next_visit);
        next_visit.clear();
        for affected_node in this_visit.iter() {
            for affecting_node in fbas.nodes[affected_node]
                .quorum_set
                .contained_nodes()
                .iter()
            {
                tmp.clear();
                tmp.union_with(&result[affected_node]);
                if !result[affecting_node].is_superset(&tmp) {
                    result[affecting_node].union_with(&tmp);
                    next_visit.insert(affecting_node);
                }
            }
        }
    }
    result
}
pub fn find_affected_nodes_per_node ( fbas : & Fbas ) -> Vec < NodeIdSet > { let mut result : Vec < NodeIdSet > = ( 0 .. fbas . number_of_nodes ( ) ) . map ( | node_id | bitset ! { node_id } ) . collect ( ) ; let mut this_visit = NodeIdSet :: new ( ) ; let mut next_visit = fbas . all_nodes ( ) ; let mut tmp = NodeIdSet :: new ( ) ; // for fewer memory allocations while ! next_visit . is_empty ( ) { this_visit . clear ( ) ; this_visit . union_with ( & next_visit ) ; next_visit . clear ( ) ; for affected_node in this_visit . iter ( ) { for affecting_node in fbas . nodes [ affected_node ] . quorum_set . contained_nodes ( ) . iter ( ) { tmp . clear ( ) ; tmp . union_with ( & result [ affected_node ] ) ; if ! result [ affecting_node ] . is_superset ( & tmp ) { result [ affecting_node ] . union_with ( & tmp ) ; next_visit . insert ( affecting_node ) ; } } } } result }
Find nodes that are affected by each node v, i.e., that point to v after a few steps; nodes
also affect themselves.
Find nodes that are affected by each node v i . e . that point to v after a few steps ; nodes also affect themselves .
fbas
&Fbas
fbas
&Fbas