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); }