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

Method induce

crates/kernel/src/shard.rs:492–515  ·  view source on GitHub ↗

Induce the sub-hypergraph on the local vertices selected by `keep`, applying cut-net splitting: each net is restricted to its kept pins and dropped if fewer than two remain.

(&self, keep: &[bool])

Source from the content-addressed store, hash-verified

490
491 fn num_vertices(&self) -> usize {
492 self.vw.len()
493 }
494
495 /// Borrow this sub-hypergraph as a [`Level`] for the greedy / FM machinery.
496 fn level(&self) -> Level<'_> {
497 Level { vw: &self.vw, bw: &self.bw, nets: &self.nets, vnets: &self.vnets }
498 }
499
500 /// Induce the sub-hypergraph on the local vertices selected by `keep`,
501 /// applying cut-net splitting: each net is restricted to its kept pins and
502 /// dropped if fewer than two remain.
503 fn induce(&self, keep: &[bool]) -> SubHyper {
504 let mut remap = vec![u32::MAX; self.num_vertices()];
505 let mut global = Vec::new();
506 let mut vw = Vec::new();
507 for v in 0..self.num_vertices() {
508 if keep[v] {
509 remap[v] = global.len() as u32;
510 global.push(self.global[v]);
511 vw.push(self.vw[v]);
512 }
513 }
514 let mut nets = Vec::new();
515 for (w, pins) in &self.nets {
516 let kept: Vec<u32> = pins
517 .iter()
518 .filter(|&&p| keep[p as usize])

Callers 1

rec_bisectFunction · 0.80

Calls 4

num_verticesMethod · 0.80
pushMethod · 0.80
lenMethod · 0.45
iterMethod · 0.45

Tested by

no test coverage detected