fn label_irc(vec: &Vec<Vec<(usize,usize)>>) -> HashMap<usize, (usize,usize)> {
    let mut out = HashMap::<usize, (usize,usize)>::new(); // Map of the index of the compound to the indices of the components.

    'a: for a in 0..vec.len() { // `a` is the index of the base set
        for b in 0..vec.len() { // `b` is the index of a potential subset of `a`
            if vec[b].len() >= vec[a].len() { // A strict subset must be smaller than the base.
                continue
            }
            if vec[b][0] > vec[a][0] { // One of the subsets must contain the first facet.
                break
            }
            let mut i = 0;
            for f in &vec[a] { // Searches through `b` to see if all elements are in `a`.
                if &vec[b][i] > f {
                    continue
                }
                if &vec[b][i] < f {
                    break
                }
                i += 1;

                if i >= vec[b].len() { // We've found a subset.
                    let mut complement = Vec::new();

                    let mut j = 0;
                    for g in &vec[a] {
                        if j >= vec[b].len() {
                            complement.push(*g);
                            continue
                        }
                        if &vec[b][j] > g {
                            complement.push(*g);
                            continue
                        }
                        j += 1;
                    }

                    for c in b+1..vec.len() { // Look for its complement.
                        if vec[c] == complement {
                            out.insert(a,(b,c));
                            break
                        }
                    }
                    continue 'a;
                }
            }
        }
    }
    out
}
/// For each faceting, checks if it is a compound of other facetings, and labels it if so.
For each faceting, checks if it is a compound of other facetings, and labels it if so.
For each faceting checks if it is a compound of other facetings and labels it if so .
fn label_irc(vec: &Vec<Vec<(usize,usize)>>) -> HashMap<usize, (usize,usize)> {
    let mut out = HashMap::<usize, (usize,usize)>::new(); // Map of the index of the compound to the indices of the components.
    'a: for a in 0..vec.len() { // `a` is the index of the base set
        for b in 0..vec.len() { // `b` is the index of a potential subset of `a`
            if vec[b].len() >= vec[a].len() { // A strict subset must be smaller than the base.
                continue
            }
            if vec[b][0] > vec[a][0] { // One of the subsets must contain the first facet.
                break
            }
            let mut i = 0;
            for f in &vec[a] { // Searches through `b` to see if all elements are in `a`.
                if &vec[b][i] > f {
                    continue
                }
                if &vec[b][i] < f {
                    break
                }
                i += 1;
                if i >= vec[b].len() { // We've found a subset.
                    let mut complement = Vec::new();
                    let mut j = 0;
                    for g in &vec[a] {
                        if j >= vec[b].len() {
                            complement.push(*g);
                            continue
                        }
                        if &vec[b][j] > g {
                            complement.push(*g);
                            continue
                        }
                        j += 1;
                    }
                    for c in b+1..vec.len() { // Look for its complement.
                        if vec[c] == complement {
                            out.insert(a,(b,c));
                            break
                        }
                    }
                    continue 'a;
                }
            }
        }
    }
    out
}
fn label_irc ( vec : & Vec < Vec < ( usize , usize ) > > ) -> HashMap < usize , ( usize , usize ) > { let mut out = HashMap :: < usize , ( usize , usize ) > :: new ( ) ; // Map of the index of the compound to the indices of the components. ' a : for a in 0 .. vec . len ( ) { // `a` is the index of the base set for b in 0 .. vec . len ( ) { // `b` is the index of a potential subset of `a` if vec [ b ] . len ( ) >= vec [ a ] . len ( ) { // A strict subset must be smaller than the base. continue } if vec [ b ] [ 0 ] > vec [ a ] [ 0 ] { // One of the subsets must contain the first facet. break } let mut i = 0 ; for f in & vec [ a ] { // Searches through `b` to see if all elements are in `a`. if & vec [ b ] [ i ] > f { continue } if & vec [ b ] [ i ] < f { break } i += 1 ; if i >= vec [ b ] . len ( ) { // We've found a subset. let mut complement = Vec :: new ( ) ; let mut j = 0 ; for g in & vec [ a ] { if j >= vec [ b ] . len ( ) { complement . push ( * g ) ; continue } if & vec [ b ] [ j ] > g { complement . push ( * g ) ; continue } j += 1 ; } for c in b + 1 .. vec . len ( ) { // Look for its complement. if vec [ c ] == complement { out . insert ( a , ( b , c ) ) ; break } } continue ' a ; } } } } out }
For each faceting, checks if it is a compound of other facetings, and labels it if so.
For each faceting checks if it is a compound of other facetings and labels it if so .
vec
&Vec<Vec<(usize,usize)>>