TriangularGadget

Trait TriangularGadget 

Source
pub trait TriangularGadget {
    // 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<LegacySourceCell>> { ... }
    fn mapped_matrix(&self) -> Vec<Vec<bool>> { ... }
}
Expand description

Trait for triangular lattice gadgets (simplified interface).

Note: source_graph returns explicit edges (like Julia’s simplegraph), while mapped_graph locations should use unit disk edges.

Required Methods§

Source

fn size(&self) -> (usize, usize)

Source

fn cross_location(&self) -> (usize, usize)

Source

fn is_connected(&self) -> bool

Source

fn source_graph(&self) -> (Vec<(usize, usize)>, Vec<(usize, usize)>, Vec<usize>)

Returns (locations, edges, pins) - edges are explicit, not unit disk.

Source

fn mapped_graph(&self) -> (Vec<(usize, usize)>, Vec<usize>)

Returns (locations, pins) - use unit disk for edges on triangular lattice.

Source

fn mis_overhead(&self) -> i32

Provided Methods§

Source

fn connected_nodes(&self) -> Vec<usize>

Returns 1-indexed node indices that should be Connected (matching Julia).

Source

fn source_weights(&self) -> Vec<i32>

Returns source node weights. Default is weight 2 for all nodes.

Source

fn mapped_weights(&self) -> Vec<i32>

Returns mapped node weights. Default is weight 2 for all nodes.

Source

fn source_matrix(&self) -> Vec<Vec<LegacySourceCell>>

Generate source matrix for pattern matching. Returns LegacySourceCell::Connected for nodes in connected_nodes() when is_connected() is true.

Source

fn mapped_matrix(&self) -> Vec<Vec<bool>>

Generate mapped matrix for gadget application.

Implementors§