Function best_eulerian_circuit_segments

Source
fn best_eulerian_circuit_segments(
    graph: &DHashMap<usize, DockNode>,
    circuit: &[usize],
) -> Option<(Vec<Vec<usize>>, usize, f32)>
Expand description

Get the optimal grouping of Eulerian Circuit nodes and edges such that a maximum number of sub-circuits are created, and the length of each sub-circuit is as similar as possible.

The Airship dock nodes are connected in a Eulerian Circuit, where each edge of the tessellation is traversed exactly once. The circuit is a closed loop, so the first and last node are the same. The single circuit can be broken into multiple segments, each being also a closed loop. This is desirable for airship routes, to limit the number of airships associated with each “route” where a route is a closed circuit of docking sites. Since each edge is flown in only one direction, the maximum number of possible closed loop segments is equal to the maximum number of edges connected to any node, divided by 2.