/** * {@inheritDoc} */ @Override public Set<E> getAllEdges(V sourceVertex, V targetVertex) { return delegate.getAllEdges(sourceVertex, targetVertex); }
public Set<Scope> getAllEdges( FlowElement sourceVertex, FlowElement targetVertex ) { return graph.getAllEdges( sourceVertex, targetVertex ); }
/** Check whether the topology has the same number of links between each node pair in both directions (assuming multi-digraphs). * * @param graph The graph to analyze * @return {@code true} if the graph is bidirectional, and false otherwise */ public static boolean isBidirectional(org.jgrapht.Graph graph) { Object[] vertices = graph.vertexSet().toArray(); for (int v1 = 0; v1 < vertices.length; v1++) for (int v2 = v1 + 1; v2 < vertices.length; v2++) if (graph.getAllEdges(vertices[v1], vertices[v2]).size() != graph.getAllEdges(vertices[v2], vertices[v1]).size()) return false; return true; }
/** Check whether the graph is simple, that is, if it has at most one link between each node pair (one per direction under directed graphs, one under undirected graphs). * * @param graph The graph to analyze * @return {@code true} if the graph is simple, and false otherwise */ public static boolean isSimple(org.jgrapht.Graph graph) { Object[] vertices = graph.vertexSet().toArray(); for (int v1 = 0; v1 < vertices.length; v1++) { for (int v2 = v1 + 1; v2 < vertices.length; v2++) { if (graph.getAllEdges(vertices[v1], vertices[v2]).size() > 1) return false; if (graph.getAllEdges(vertices[v2], vertices[v1]).size() > 1) return false; } } return true; }
/** * {@inheritDoc} */ @Override public Set<E> getAllEdges(V sourceVertex, V targetVertex) { if (containsVertex(sourceVertex) && containsVertex(targetVertex)) { return base .getAllEdges(sourceVertex, targetVertex).stream().filter(edgeSet::contains) .collect(Collectors.toCollection(LinkedHashSet::new)); } else { return null; } }
/** * {@inheritDoc} */ @Override public Set<E> getAllEdges(V sourceVertex, V targetVertex) { boolean inG1 = g1.containsVertex(sourceVertex) && g1.containsVertex(targetVertex); boolean inG2 = g2.containsVertex(sourceVertex) && g2.containsVertex(targetVertex); if (inG1 && inG2) { return new UnmodifiableUnionSet<>( g1.getAllEdges(sourceVertex, targetVertex), g2.getAllEdges(sourceVertex, targetVertex)); } else if (inG1) { return Collections.unmodifiableSet(g1.getAllEdges(sourceVertex, targetVertex)); } else if (inG2) { return Collections.unmodifiableSet(g2.getAllEdges(sourceVertex, targetVertex)); } return Collections.emptySet(); }
Set links_12 = graph.getAllEdges(vertices[vertexId_1], vertices[vertexId_2]); Set links_21 = graph.getAllEdges(vertices[vertexId_2], vertices[vertexId_1]);
/** * {@inheritDoc} */ @Override public Set<E> getAllEdges(V sourceVertex, V targetVertex) { if (containsVertex(sourceVertex) && containsVertex(targetVertex)) { return new MaskEdgeSet<>( base, base.getAllEdges(sourceVertex, targetVertex), vertexMask, edgeMask); } else return null; }
@Override public Set<Edge> getAllEdges( Object sourceVertex, Object targetVertex ) { Node lhsNode = getVertex( (int) sourceVertex ); Node rhsNode = getVertex( ( (int) targetVertex ) ); return getDelegate().getAllEdges( lhsNode, rhsNode ); }
private void performLazyInspection() { if (blocks == null) { init(); // Iterate over all connected components for (V v : graph.vertexSet()) { if (discTime.get(v) == -1) { connectedSet = new HashSet<>(); dfs(v, null); // Stack can be non-empty when dfs finishes, for instance if the graph has no // cutpoints. // Construct the final component from the remaining edges. if (!stack.isEmpty()) buildBlock(0); connectedSets.add(connectedSet); } } if (this.graph.getType().isAllowingMultipleEdges()) { // check parallel edges: an edge is not a bridge when there are multiple edges // between the same pair of vertices for (Iterator<E> it = bridges.iterator(); it.hasNext();) { E edge = it.next(); int nrParallelEdges = graph .getAllEdges(graph.getEdgeSource(edge), graph.getEdgeTarget(edge)).size(); if (nrParallelEdges > 1) it.remove(); } } } }
Set<E> edges = base.getAllEdges(sourceVertex, targetVertex);
for (int i = 0; i <= j; i++) { if (g.containsEdge(vertices.get(i), vertices.get(j))) { for (int p = 0; p < g.getAllEdges(vertices.get(i), vertices.get(j)).size(); p++)
if (!isAllowingMultipleEdges || graph.getAllEdges(u, v).size() == 1) continue;
continue; if( contracted.getAllEdges( inner, outer ).isEmpty() ) excludeEdges.addAll( full.getAllEdges( inner, outer ) );