map_weighted

Function map_weighted 

Source
pub fn map_weighted(
    num_vertices: usize,
    edges: &[(usize, usize)],
) -> MappingResult
Expand description

Map a graph to a weighted triangular lattice grid graph using optimal path decomposition.

This is the main entry point for triangular lattice mapping. It uses automatic path decomposition (exact for ≤30 vertices, greedy for larger).

§Arguments

  • num_vertices - Number of vertices in the original graph
  • edges - Edge list as (u, v) pairs

§Returns

A MappingResult containing the grid graph and mapping metadata.

§Panics

Panics if num_vertices == 0.

§Example

use problemreductions::rules::unitdiskmapping::triangular::mapping::map_weighted;
use problemreductions::topology::Graph;

let edges = vec![(0, 1), (1, 2)];
let result = map_weighted(3, &edges);
assert!(result.to_triangular_subgraph().num_vertices() > 0);