Ejemplo n.º 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);
    }
Ejemplo n.º 2
0
 /**
  * .
  *
  * @param e
  */
 public void removeEdge(EE e) {
   vertexEdges.remove(e);
 }
Ejemplo n.º 3
0
 /**
  * .
  *
  * @param e
  */
 public void removeOutgoingEdge(EE e) {
   outgoing.remove(e);
 }
Ejemplo n.º 4
0
 /**
  * .
  *
  * @param e
  */
 public void removeIncomingEdge(EE e) {
   incoming.remove(e);
 }