Skip to main content

Module customize

Module customize 

Source
Expand description

Per-metric CCH customization — a faithful port of the single-threaded CustomizableContractionHierarchyMetric::customize() from RoutingKit (oracle/routingkit-cch/RoutingKit/src/customizable_contraction_hierarchy.cpp).

Given the Cch structure (built by Cch::build, including the Part-A input-arc → CCH-arc mapping) and a per-INPUT-arc weights slice, Metric holds the customized forward / backward shortcut weights, BIT-IDENTICAL to the C++ for the same graph + order + weights.

The customization is two phases:

  1. reset (extract_initial_metric*, C++ 659–690): each CCH arc’s forward/backward weight is initialized to the weight of its mapped input arc (or INF_WEIGHT if none), then min-combined with any parallel (extra) input arcs.
  2. lower-triangle relaxation (customize(), C++ 773–805): for each lower triangle (bottom, mid, top) in the enumeration order driven by up_first_out/down_first_out/down_to_up, min_to(forward[top], backward[bottom] + forward[mid]) and min_to(backward[top], forward[bottom] + backward[mid]).

Structs§

Customizer
Reusable customizer for one Cch. Owns the metric-independent elimination-tree level partition so repeated customizations do not recompute it, and lets callers reuse output buffers via Self::customize_into.
Metric
A customized metric: the forward + backward shortcut weights of every CCH arc. Field semantics match the persisted .cch-metric sections and crate::bundle::MetricView.