public SparseDirectedTypedEdgeSet<T> copy(IntSet vertices) {        
        SparseDirectedTypedEdgeSet<T> copy = 
            new SparseDirectedTypedEdgeSet<T>(rootVertex);
        if (vertices.size() < inEdges.size()
                && vertices.size() < outEdges.size()) {

            IntIterator iter = vertices.iterator();
            while (iter.hasNext()) {
                int v = iter.nextInt();
                if (inEdges.containsKey(v)) 
                    copy.inEdges.put(v, outEdges.get(v));
                if (outEdges.containsKey(v)) 
                    copy.inEdges.put(v, outEdges.get(v));
            }            
        }
        else {
            TIntObjectIterator<BitSet> iter = inEdges.iterator();
            while (iter.hasNext()) {
                iter.advance();
                int v = iter.key();
                if (vertices.contains(v))
                    copy.inEdges.put(v, iter.value());
            }
            iter = outEdges.iterator();
            while (iter.hasNext()) {
                iter.advance();
                int v = iter.key();
                if (vertices.contains(v))
                    copy.outEdges.put(v, iter.value());
            }
        }
        return copy;
    }
public SparseDirectedTypedEdgeSet < T > copy ( IntSet vertices ) { SparseDirectedTypedEdgeSet < T > copy = new SparseDirectedTypedEdgeSet < T > ( rootVertex ) ; if ( vertices . size ( ) < inEdges . size ( ) && vertices . size ( ) < outEdges . size ( ) ) { IntIterator iter = vertices . iterator ( ) ; while ( iter . hasNext ( ) ) { int v = iter . nextInt ( ) ; if ( inEdges . containsKey ( v ) ) copy . inEdges . put ( v , outEdges . get ( v ) ) ; if ( outEdges . containsKey ( v ) ) copy . inEdges . put ( v , outEdges . get ( v ) ) ; } } else { TIntObjectIterator < BitSet > iter = inEdges . iterator ( ) ; while ( iter . hasNext ( ) ) { iter . advance ( ) ; int v = iter . key ( ) ; if ( vertices . contains ( v ) ) copy . inEdges . put ( v , iter . value ( ) ) ; } iter = outEdges . iterator ( ) ; while ( iter . hasNext ( ) ) { iter . advance ( ) ; int v = iter . key ( ) ; if ( vertices . contains ( v ) ) copy . outEdges . put ( v , iter . value ( ) ) ; } } return copy ; }
{@inheritDoc}