protected Collection getCells(Collection cells, boolean edges,
	    boolean ordered) {
	Set result = null;
	if (ordered && order != null) {
	    result = new TreeSet(order);
	} else {
	    result = new LinkedHashSet();
	}
	Iterator it = cells.iterator();
	while (it.hasNext()) {
	    Object cell = it.next();
	    if ((edges && isEdge(cell)) && (getSource(cell) != null)
		    && (getTarget(cell) != null))
		result.add(cell);
	    if (!edges && isVertex(cell)) {
		result.add(cell);
	    }
	}
	return result;
    }