Skip to main content

two_phase_spanning_trees

Function two_phase_spanning_trees 

Source
pub fn two_phase_spanning_trees<C: Cost + ExactArith>(
    nodes: usize,
    edges: &[TreeEdge<C, 2>],
) -> Vec<Tree<C, 2>>
Expand description

The two-phase method for bi-objective spanning trees (Ramos et al. 1998): phase 1 finds the extreme supported trees by dichotomic search with weighted-sum Kruskal (weights from neighbouring trees, compared exactly through ExactArith, ties lexicographic); phase 2 finds the rest by branch and bound restricted to each triangle between neighbours. Same result as pareto_spanning_trees.

ยงExamples

use multiobjective_search::{pareto_spanning_trees, two_phase_spanning_trees};

let edges = [(0, 1, [1_u32, 5]), (1, 2, [2, 2]), (0, 2, [5, 1]), (1, 3, [1, 1]), (2, 3, [3, 4])];
assert_eq!(two_phase_spanning_trees(4, &edges), pareto_spanning_trees(4, &edges));