Skip to content
Snippets Groups Projects
Commit bcc296f5 authored by nanocryk's avatar nanocryk
Browse files

[fix] Keep less then k_max distance paths

parent 9fdc469e
No related branches found
No related tags found
1 merge request!29Resolve "RustyWot : get_paths is stuck in an infinite loop !"
......@@ -260,13 +260,21 @@ impl WebOfTrust for RustyWebOfTrust {
let mut new_paths = vec![];
for path in &paths {
let sources = &graph[path.last().unwrap().0];
let node = path.last().unwrap();
if node == &to {
// If path is complete, we keep it.
new_paths.push(path.clone())
} else {
// If not complete we comlete paths
let sources = &graph[node.0];
for source in &sources.1 {
let mut new_path = path.clone();
new_path.push(NodeId(*source));
new_paths.push(new_path);
}
}
}
paths = new_paths;
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment