示例#1
0
 public V getEdgeSource(E e) {
   if (g1.containsEdge(e)) {
     return g1.getEdgeSource(e);
   }
   if (g2.containsEdge(e)) {
     return g2.getEdgeSource(e);
   }
   return null;
 }
示例#2
0
 public V getEdgeTarget(E e) {
   if (g1.containsEdge(e)) {
     return g1.getEdgeTarget(e);
   }
   if (g2.containsEdge(e)) {
     return g2.getEdgeTarget(e);
   }
   return null;
 }
示例#3
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);
 }
示例#4
0
 public double getEdgeWeight(E e) {
   if (g1.containsEdge(e) && g2.containsEdge(e)) {
     return operator.combine(g1.getEdgeWeight(e), g2.getEdgeWeight(e));
   }
   if (g1.containsEdge(e)) {
     return g1.getEdgeWeight(e);
   }
   if (g2.containsEdge(e)) {
     return g2.getEdgeWeight(e);
   }
   throw new IllegalArgumentException("no such edge in the union");
 }
示例#5
0
 public E getEdge(V sourceVertex, V targetVertex) {
   E res = null;
   if (g1.containsVertex(sourceVertex) && g1.containsVertex(targetVertex)) {
     res = g1.getEdge(sourceVertex, targetVertex);
   }
   if ((res == null) && g2.containsVertex(sourceVertex) && g2.containsVertex(targetVertex)) {
     res = g2.getEdge(sourceVertex, targetVertex);
   }
   return res;
 }
示例#6
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);
 }
示例#7
0
 public Set<V> vertexSet() {
   Set<V> res = new HashSet<V>();
   res.addAll(g1.vertexSet());
   res.addAll(g2.vertexSet());
   return Collections.unmodifiableSet(res);
 }
示例#8
0
 public Set<E> edgeSet() {
   Set<E> res = new HashSet<E>();
   res.addAll(g1.edgeSet());
   res.addAll(g2.edgeSet());
   return Collections.unmodifiableSet(res);
 }
示例#9
0
 public boolean containsVertex(V v) {
   return g1.containsVertex(v) || g2.containsVertex(v);
 }
示例#10
0
 public boolean containsEdge(E e) {
   return g1.containsEdge(e) || g2.containsEdge(e);
 }