* {@inheritDoc}
*/
public SparseWeightedEdgeSet copy(IntSet vertices) {
SparseWeightedEdgeSet copy = new SparseWeightedEdgeSet(rootVertex);
if (edges.size() < vertices.size()) {
TIntDoubleIterator iter = edges.iterator();
while (iter.hasNext()) {
iter.advance();
int v = iter.key();
if (vertices.contains(v))
copy.edges.put(v, iter.value());
}
}
else {
IntIterator iter = vertices.iterator();
while (iter.hasNext()) {
int v = iter.nextInt();
if (edges.containsKey(v))
copy.edges.put(v, edges.get(v));
}
}
return copy;