Skip to content

RustyWot : get_paths is stuck in an infinite loop !

I tested your Rusty implementation in my project, compute_distance() seems to work well but get_paths() doesn't work! I've tested get_paths() to calculate the intermediation centrality of the members, I've tested both implementations with the following code, LegacyWoT works perfectly, RustyWoT is stuck in an infinite loop :

let wot_size = wot.size();
let mut centralities = vec![0;wot_size];
    for i in 0..wot_size {
        for j in 0..wot_size {
            let paths = wot.get_paths(NodeId(i), NodeId(j), step_max);
            let mut intermediate_members :Vec<NodeId> = Vec::new();
            for path in paths {
                if path.len() > 2 {
                    for node_id in &path[1..path.len()-1] {
                        if !intermediate_members.contains(node_id) {
                            intermediate_members.push(*node_id);
                        }
                    }
                }
            }
            let centralities_copy = centralities.clone();
            for node_id in intermediate_members {
                let centrality = &centralities_copy[node_id.0];
                if let Some(tmp) = centralities.get_mut(node_id.0) {
                    *tmp = *centrality + 1;
                }
            }
        }
    }
Edited by Éloïs
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information