public static TIntIntHashMap makeNodeIndex(Collection<Instance> instances) {
        TIntIntHashMap index = new TIntIntHashMap();
        int p = 0;
        for (Instance i : instances) {
            Mapping m = i.getModel().getMapping();
            for (Node n : m.getOfflineNodes()) {
                index.put(n.id(), p);
            }
            for (Node n : m.getOnlineNodes()) {
                index.put(n.id(), p);
            }
            p++;
        }
        return index;
    }
public static TIntIntHashMap makeNodeIndex ( Collection < Instance > instances ) { TIntIntHashMap index = new TIntIntHashMap ( ) ; int p = 0 ; for ( Instance i : instances ) { Mapping m = i . getModel ( ) . getMapping ( ) ; for ( Node n : m . getOfflineNodes ( ) ) { index . put ( n . id ( ) , p ) ; } for ( Node n : m . getOnlineNodes ( ) ) { index . put ( n . id ( ) , p ) ; } p ++ ; } return index ; }
Make an index revealing the position of each node in a collection
of disjoint instances

@param instances the collection to browse. Instances are supposed to be disjoint
@return the index of every node. Format {@code Node#id() -> position}