pub trait WeightedTriangularGadget {
// Required methods
fn size(&self) -> (usize, usize);
fn cross_location(&self) -> (usize, usize);
fn is_connected(&self) -> bool;
fn source_graph(
&self,
) -> (Vec<(usize, usize)>, Vec<(usize, usize)>, Vec<usize>);
fn mapped_graph(&self) -> (Vec<(usize, usize)>, Vec<usize>);
fn mis_overhead(&self) -> i32;
// Provided methods
fn connected_nodes(&self) -> Vec<usize> { ... }
fn source_weights(&self) -> Vec<i32> { ... }
fn mapped_weights(&self) -> Vec<i32> { ... }
fn source_matrix(&self) -> Vec<Vec<SourceCell>> { ... }
fn mapped_matrix(&self) -> Vec<Vec<bool>> { ... }
}Expand description
Trait for weighted triangular lattice gadgets.
Note: source_graph returns explicit edges (like Julia’s simplegraph), while mapped_graph locations should use unit disk edges.
Required Methods§
fn size(&self) -> (usize, usize)
fn cross_location(&self) -> (usize, usize)
fn is_connected(&self) -> bool
Sourcefn source_graph(&self) -> (Vec<(usize, usize)>, Vec<(usize, usize)>, Vec<usize>)
fn source_graph(&self) -> (Vec<(usize, usize)>, Vec<(usize, usize)>, Vec<usize>)
Returns (locations, edges, pins) - edges are explicit, not unit disk.
Sourcefn mapped_graph(&self) -> (Vec<(usize, usize)>, Vec<usize>)
fn mapped_graph(&self) -> (Vec<(usize, usize)>, Vec<usize>)
Returns (locations, pins) - use unit disk for edges on triangular lattice.
fn mis_overhead(&self) -> i32
Provided Methods§
Sourcefn connected_nodes(&self) -> Vec<usize>
fn connected_nodes(&self) -> Vec<usize>
Returns 1-indexed node indices that should be Connected (matching Julia).
Sourcefn source_weights(&self) -> Vec<i32>
fn source_weights(&self) -> Vec<i32>
Returns source node weights. Default is weight 2 for all nodes.
Sourcefn mapped_weights(&self) -> Vec<i32>
fn mapped_weights(&self) -> Vec<i32>
Returns mapped node weights. Default is weight 2 for all nodes.
Sourcefn source_matrix(&self) -> Vec<Vec<SourceCell>>
fn source_matrix(&self) -> Vec<Vec<SourceCell>>
Generate source matrix for pattern matching. Returns SourceCell::Connected for nodes in connected_nodes() when is_connected() is true.
Sourcefn mapped_matrix(&self) -> Vec<Vec<bool>>
fn mapped_matrix(&self) -> Vec<Vec<bool>>
Generate mapped matrix for gadget application.