fn plan_join_order(source: usize, constraints: &[Vec<(usize, usize)>]) -> Vec<usize> {

    let mut result = vec![source];
    let mut active = true;
    while active {
        active = false;
        for constraint in constraints.iter() {
            // Check to see if the constraint contains a sequenced relation.
            if constraint.iter().any(|(_,index)| result.contains(index)) {
                // If so, sequence any unsequenced relations.
                for (_, index) in constraint.iter() {
                    if !result.contains(index) {
                        result.push(*index);
                        active = true;
                    }
                }
            }
        }
    }

    result
}
Sequences relations in `constraints`.

Relations become available for sequencing as soon as they share a constraint with
either `source` or another sequenced relation.
interactive/src/plan/sfw.rs