for (int i = 0; i < relatedElements.size(); i++) { Element element = (Element)relatedElements.elementAt(i); if (element instanceof Node) { Enumeration edges = ((Node)element).edgeElements(); boolean hasEdges = false; while (edges.hasMoreElements()) { if (relatedElements.contains(edges.nextElement())) { hasEdges = true; break; } } if (!hasEdges) relatedElements.remove(i--); } }
  private void showDualRelationship(String rel1, String rel2) {    Vector selectedElements = graph.getSelectedElements();    if (selectedElements == null)      return;    Vector relatedElements = getRelatedElements(selectedElements, rel1);    Vector addl = getRelatedElements(selectedElements, rel2);    for (int i = 0; i < addl.size(); i++)       if (!relatedElements.contains(addl.elementAt(i)))	relatedElements.add(addl.elementAt(i));    if (relatedElements.size() == 0)      return;    graph.select(relatedElements);    CSMARTGraph newGraph = graph.newGraphWithSelectedElementsOnly();    new ULSocietyFrame(rel1 + "/" + rel2, newGraph);  }