/** @see Graph#vertexSet() */
  public Set<V> vertexSet() {
    if (unmodifiableVertexSet == null) {
      unmodifiableVertexSet = Collections.unmodifiableSet(specifics.getVertexSet());
    }

    return unmodifiableVertexSet;
  }
    /**
     * A lazy build of unmodifiable list of vertex edges
     *
     * @return
     */
    public Set<EE> getUnmodifiableVertexEdges() {
      if (unmodifiableVertexEdges == null) {
        unmodifiableVertexEdges = Collections.unmodifiableSet(vertexEdges);
      }

      return unmodifiableVertexEdges;
    }
    /**
     * A lazy build of unmodifiable outgoing edge set.
     *
     * @return
     */
    public Set<EE> getUnmodifiableOutgoingEdges() {
      if (unmodifiableOutgoing == null) {
        unmodifiableOutgoing = Collections.unmodifiableSet(outgoing);
      }

      return unmodifiableOutgoing;
    }
 /** {@inheritDoc} */
 @Override
 public Set<E> getMatching() {
   if (matching == null) {
     matching = findMatch();
   }
   return Collections.unmodifiableSet(matching);
 }
  /** @see Graph#edgeSet() */
  public Set<E> edgeSet() {
    if (unmodifiableEdgeSet == null) {
      unmodifiableEdgeSet = Collections.unmodifiableSet(edgeMap.keySet());
    }

    return unmodifiableEdgeSet;
  }
 public Set<E> outgoingEdgesOf(V vertex) {
   Set<E> res = new HashSet<E>();
   if (getG1().containsVertex(vertex)) {
     res.addAll(getG1().outgoingEdgesOf(vertex));
   }
   if (getG2().containsVertex(vertex)) {
     res.addAll(getG2().outgoingEdgesOf(vertex));
   }
   return Collections.unmodifiableSet(res);
 }
Example #7
0
 public Set<E> getAllEdges(V sourceVertex, V targetVertex) {
   Set<E> res = new HashSet<E>();
   if (g1.containsVertex(sourceVertex) && g1.containsVertex(targetVertex)) {
     res.addAll(g1.getAllEdges(sourceVertex, targetVertex));
   }
   if (g2.containsVertex(sourceVertex) && g2.containsVertex(targetVertex)) {
     res.addAll(g2.getAllEdges(sourceVertex, targetVertex));
   }
   return Collections.unmodifiableSet(res);
 }
Example #8
0
 public Set<E> edgesOf(V vertex) {
   Set<E> res = new HashSet<E>();
   if (g1.containsVertex(vertex)) {
     res.addAll(g1.edgesOf(vertex));
   }
   if (g2.containsVertex(vertex)) {
     res.addAll(g2.edgesOf(vertex));
   }
   return Collections.unmodifiableSet(res);
 }
    /** @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);
    }
Example #10
0
 public Set<V> vertexSet() {
   Set<V> res = new HashSet<V>();
   res.addAll(g1.vertexSet());
   res.addAll(g2.vertexSet());
   return Collections.unmodifiableSet(res);
 }
Example #11
0
 public Set<E> edgeSet() {
   Set<E> res = new HashSet<E>();
   res.addAll(g1.edgeSet());
   res.addAll(g2.edgeSet());
   return Collections.unmodifiableSet(res);
 }