Skip to main content

Cch

Struct Cch 

Source
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: Topology

The structural contraction hierarchy containing forward and backward shortcut arcs.

§weight_map: WeightMap

Maps 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

Source

pub fn contract<G: CchGraph + Sync>(ranks: &[u32], graph: &G) -> Topology

Source

pub fn recontract<G: CchGraph + Sync>( &self, graph: &G, start_rank: u32, old: &Topology, ) -> Topology

Source§

impl Cch

Source

pub fn build_partial_update_context(&self) -> PartialUpdateContext

Source

pub fn customize( &self, mapper: &WeightMap, scheduler: &[Vec<u32>], original_weights: &[f32], ) -> (Weights, Shortcuts)

Source

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

Source

pub fn get_metis_order<G: CchGraph>(graph: &G) -> Vec<u32>

Source§

impl Cch

Source

pub fn unpack(&self, rank_path: Vec<u32>, shortcuts: &Shortcuts) -> Vec<u32>

Source

pub fn query_path( &self, q: &Query, sc: &Shortcuts, res: &QueryResult, ) -> Vec<u32>

Source§

impl Cch

Source

pub fn query( &self, q: &mut Query, w: &Weights, from: u32, to: u32, ) -> Option<QueryResult>

Source§

impl Cch

Source

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.

Source

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.

Source

pub fn recustomize_profile( &self, profile: &mut ProfileData, new_weights: &[f32], )

Re-customizes an owned profile in place, reusing its allocations.

Source

pub fn customize_profile_partial( &self, profile: &mut ProfileData, updates: &[(usize, f32)], )

Applies a partial metric update to an owned profile in place.

Source

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.

Source

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.

Source

pub fn get_order(&self) -> &[u32]

Returns the mapping from rank to original node ID.

Source

pub fn get_ranks(&self) -> &[u32]

Returns the mapping from original node ID to rank.

Trait Implementations§

Source§

impl Clone for Cch

Source§

fn clone(&self) -> Cch

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more

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> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.