Skip to content

web search done right

no need to consider nodes where we have found a better path

Mikkel Denker90980a1aa46d
diff --git a/crates/core/src/entrypoint/ampc/approximated_harmonic_centrality/mapper.rs b/crates/core/src/entrypoint/ampc/approximated_harmonic_centrality/mapper.rs
index cf55b04f..652ccdc3 100644
--- a/crates/core/src/entrypoint/ampc/approximated_harmonic_centrality/mapper.rs
+++ b/crates/core/src/entrypoint/ampc/approximated_harmonic_centrality/mapper.rs
@@ -50,6 +50,10 @@ impl Workers {
distances.insert(source, 0u8);
while let Some(cmp::Reverse((dist, node))) = queue.pop() {
+ if dist >= max_dist || dist > *distances.get(&node).unwrap_or(&u8::MAX) {
+ break;
+ }
+
for outgoing in self
.worker
.graph()
diff --git a/crates/core/src/webgraph/store.rs b/crates/core/src/webgraph/store.rs
index b1646ea3..023a590d 100644
--- a/crates/core/src/webgraph/store.rs
+++ b/crates/core/src/webgraph/store.rs
@@ -43,7 +43,7 @@ struct SerializedEdge {
}
pub struct HostDb {
- db: speedy_kv::Db<Vec<u8>, Vec<u8>>,
+ db: speedy_kv::Db<Vec<u8>, ()>,
}
impl HostDb {
@@ -63,9 +63,8 @@ impl HostDb {
node.id.as_u64().to_le_bytes(),
]
.concat();
- let value = vec![];
- self.db.insert_raw(key, value);
+ self.db.insert_raw(key, vec![]);
}
fn get(&self, host: &NodeID) -> Vec<NodeID> {