MCPcopy Create free account
hub / github.com/argumentcomputer/ix / multilevel_separates_large_clusters

Function multilevel_separates_large_clusters

crates/kernel/src/shard.rs:2339–2365  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

2337 max_shard_steps,
2338 largest_block_steps: largest_block,
2339 infeasible_atomic_floor: infeasible,
2340 }
2341}
2342
2343/// Collect the leaf shard ids of an [`AggNode`] in left-to-right DFS order.
2344fn dfs_leaf_order(node: &AggNode, out: &mut Vec<u32>) {
2345 match node {
2346 AggNode::Leaf(id) => out.push(*id),
2347 AggNode::Internal(l, r) => {
2348 dfs_leaf_order(l, out);
2349 dfs_leaf_order(r, out);
2350 },
2351 }
2352}
2353
2354/// A balanced binary [`AggNode`] over the contiguous shard-id range `lo..hi`.
2355fn balanced_agg_tree(lo: u32, hi: u32) -> AggNode {
2356 debug_assert!(hi > lo);
2357 if hi - lo <= 1 {
2358 AggNode::Leaf(lo)
2359 } else {
2360 let mid = lo + (hi - lo) / 2;
2361 AggNode::Internal(
2362 Box::new(balanced_agg_tree(lo, mid)),
2363 Box::new(balanced_agg_tree(mid, hi)),
2364 )
2365 }
2366}
2367
2368#[cfg(test)]

Callers

nothing calls this directly

Calls 6

two_big_clustersFunction · 0.85
addr_u32Function · 0.85
partitionMethod · 0.80
num_blocksMethod · 0.80
blockMethod · 0.80
cloneMethod · 0.45

Tested by

no test coverage detected