pub struct Cch {
pub topology: Topology,
pub weight_map: WeightMap,
pub scheduler: Vec<Vec<u32>>,
pub ranks: Vec<u32>,
pub order: Vec<u32>,
}Expand description
The profile-independent, structural core of the Contraction Hierarchy.
This maintains the node ordering, the elimination tree, and the mapping from the original graph’s edges to the hierarchy’s arcs.
Fields§
§topology: TopologyThe structural contraction hierarchy containing forward and backward shortcut arcs.
weight_map: WeightMapMaps original edge indices to their corresponding arc in the Topology.
scheduler: Vec<Vec<u32>>Grouped nodes mapped by tree depth, allowing safe parallelization during customization.
ranks: Vec<u32>Maps original node IDs to their rank in the contraction order.
order: Vec<u32>Maps ranks back to their original node IDs.
Implementations§
Source§impl Cch
impl Cch
pub fn build_partial_update_context(&self) -> PartialUpdateContext
pub fn customize( &self, mapper: &WeightMap, scheduler: &[Vec<u32>], original_weights: &[f32], ) -> (Weights, Shortcuts)
pub fn customize_partial( &self, mapper: &WeightMap, ctx: &PartialUpdateContext, input_weights: &mut [f32], weights: &mut Weights, shortcuts: &mut Shortcuts, updates: &[(usize, f32)], )
Source§impl Cch
impl Cch
Sourcepub fn new<G: CchGraph + Sync>(graph: &G) -> Self
pub fn new<G: CchGraph + Sync>(graph: &G) -> Self
Constructs a new structural hierarchy from a given graph.
Computes the node contraction order via METIS, contracts the graph to build the topology, and maps out the parallel scheduler.
Sourcepub fn build_profile(&self, original_weights: &[f32]) -> ProfileData
pub fn build_profile(&self, original_weights: &[f32]) -> ProfileData
Builds a reusable mutable profile for a fixed CCH topology.
Unlike CchEngine, this is intended for single-owner workflows such as
benchmarking or offline customization, where in-place updates are acceptable.
Sourcepub fn recustomize_profile(
&self,
profile: &mut ProfileData,
new_weights: &[f32],
)
pub fn recustomize_profile( &self, profile: &mut ProfileData, new_weights: &[f32], )
Re-customizes an owned profile in place, reusing its allocations.
Sourcepub fn customize_profile_partial(
&self,
profile: &mut ProfileData,
updates: &[(usize, f32)],
)
pub fn customize_profile_partial( &self, profile: &mut ProfileData, updates: &[(usize, f32)], )
Applies a partial metric update to an owned profile in place.
Sourcepub fn customize_profile_partial_with_context(
&self,
profile: &mut ProfileData,
update_ctx: &PartialUpdateContext,
updates: &[(usize, f32)],
)
pub fn customize_profile_partial_with_context( &self, profile: &mut ProfileData, update_ctx: &PartialUpdateContext, updates: &[(usize, f32)], )
Applies a partial metric update to an owned profile in place using a reusable context.
Sourcepub fn update_order<G: CchGraph + Sync>(
&mut self,
graph: &G,
modified_old_nodes: &[u32],
new_nodes: &[u32],
) -> u32
pub fn update_order<G: CchGraph + Sync>( &mut self, graph: &G, modified_old_nodes: &[u32], new_nodes: &[u32], ) -> u32
Incrementally updates the node order mapping when new nodes are added or modified.
Returns the lowest rank affected by the changes, which serves as the starting
point for a partial topology recontract.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Cch
impl RefUnwindSafe for Cch
impl Send for Cch
impl Sync for Cch
impl Unpin for Cch
impl UnsafeUnpin for Cch
impl UnwindSafe for Cch
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more