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

Method partition

crates/kernel/src/shard.rs:221–223  ·  view source on GitHub ↗

Partition the blocks into `num_shards` shards via recursive bisection. Returns the shard id (in `0..num_shards`) for every block id. `epsilon` is the per-bisection balance tolerance (e.g. `0.05` for ±5%). `num_shards` need not be a power of two.

(&self, num_shards: usize, epsilon: f64)

Source from the content-addressed store, hash-verified

219 /// the per-bisection balance tolerance (e.g. `0.05` for ±5%). `num_shards`
220 /// need not be a power of two.
221 pub fn partition(&self, num_shards: usize, epsilon: f64) -> Vec<u32> {
222 self.partition_with_tree(num_shards, epsilon).0
223 }
224
225 /// Like [`Self::partition`], but also returns the **bisection tree** — the
226 /// binary tree of min-cut splits whose leaves are the shard ids. Reusing this

Calls 1

partition_with_treeMethod · 0.80