예제 #1
0
    /** @see Graph#edgesOf(Object) */
    public Set<E> edgesOf(V vertex) {
      ArrayUnenforcedSet<E> inAndOut = new ArrayUnenforcedSet<E>(getEdgeContainer(vertex).incoming);
      inAndOut.addAll(getEdgeContainer(vertex).outgoing);

      // we have two copies for each self-loop - remove one of them.
      if (allowingLoops) {
        Set<E> loops = getAllEdges(vertex, vertex);

        for (int i = 0; i < inAndOut.size(); ) {
          Object e = inAndOut.get(i);

          if (loops.contains(e)) {
            inAndOut.remove(i);
            loops.remove(e); // so we remove it only once
          } else {
            i++;
          }
        }
      }

      return Collections.unmodifiableSet(inAndOut);
    }
예제 #2
0
 /**
  * .
  *
  * @param e
  */
 public void removeEdge(EE e) {
   vertexEdges.remove(e);
 }
예제 #3
0
 /**
  * .
  *
  * @param e
  */
 public void removeOutgoingEdge(EE e) {
   outgoing.remove(e);
 }
예제 #4
0
 /**
  * .
  *
  * @param e
  */
 public void removeIncomingEdge(EE e) {
   incoming.remove(e);
 }