/** * {@inheritDoc} */ @Override public boolean removeVertex(V v) { return delegate.removeVertex(v); }
public boolean removeVertex( FlowElement flowElement ) { return graph.removeVertex( flowElement ); }
/** * Remove a peak from the sequence of peaks. * * @param peak the peak to remove */ public void removePeak (StaffPeak peak) { if (peak.isVip()) { logger.info("VIP {} removing {}", this, peak); } peaks.remove(peak); peakGraph.removeVertex(peak); }
/** * Removes {@code vertex} from the graph being built, if such vertex exist in graph. * * @param vertex the vertex to remove * * @return this builder object * * @see Graph#removeVertex(Object) */ public B removeVertex(V vertex) { this.graph.removeVertex(vertex); return this.self(); }
@Override protected List<ATermAppl> computeDefinitionOrder() { final List<ATermAppl> definitionOrder = CollectionUtils.makeList(); definitionOrder.add(TOP); definitionOrder.addAll(getEquivalents(TOP)); _graph.removeVertex(TOP); destructiveTopologocialSort(definitionOrder); definitionOrder.add(BOTTOM); return definitionOrder; }
@Override protected List<ATermAppl> computeDefinitionOrder() { final List<ATermAppl> definitionOrder = CollectionUtils.makeList(); definitionOrder.add(TOP); definitionOrder.addAll(getEquivalents(TOP)); _graph.removeVertex(TOP); destructiveTopologocialSort(definitionOrder); definitionOrder.add(BOTTOM); return definitionOrder; }
@Override public VertexCover<V> getVertexCover() { Set<V> cover = new LinkedHashSet<>(); double weight = 0; Graph<V, E> copy = new AsSubgraph<>(graph, null, null); Map<V, Double> W = new HashMap<>(); for (V v : graph.vertexSet()) W.put(v, vertexWeightMap.get(v)); // Main loop Set<E> edgeSet = copy.edgeSet(); while (!edgeSet.isEmpty()) { // Pick arbitrary edge E e = edgeSet.iterator().next(); V p = copy.getEdgeSource(e); V q = copy.getEdgeTarget(e); if (W.get(p) <= W.get(q)) { W.put(q, W.get(q) - W.get(p)); cover.add(p); weight += vertexWeightMap.get(p); copy.removeVertex(p); } else { W.put(p, W.get(p) - W.get(q)); cover.add(q); weight += vertexWeightMap.get(q); copy.removeVertex(q); } } return new VertexCoverAlgorithm.VertexCoverImpl<>(cover, weight); }
sg.removeVertex(u); sg.removeVertex(v);
private void collapseCycle(final Set<ATermAppl> scc) { final Iterator<ATermAppl> i = scc.iterator(); final ATermAppl rep = i.next(); while (i.hasNext()) { final ATermAppl node = i.next(); addEquivalent(rep, node); for (final DefaultEdge edge : _graph.incomingEdgesOf(node)) { final ATermAppl incoming = _graph.getEdgeSource(edge); if (!incoming.equals(rep)) _graph.addEdge(incoming, rep); } for (final DefaultEdge edge : _graph.outgoingEdgesOf(node)) { final ATermAppl outgoing = _graph.getEdgeTarget(edge); if (!outgoing.equals(rep)) _graph.addEdge(rep, outgoing); } _graph.removeVertex(node); } }
private void collapseCycle(final Set<ATermAppl> scc) { final Iterator<ATermAppl> i = scc.iterator(); final ATermAppl rep = i.next(); while (i.hasNext()) { final ATermAppl node = i.next(); addEquivalent(rep, node); for (final DefaultEdge edge : _graph.incomingEdgesOf(node)) { final ATermAppl incoming = _graph.getEdgeSource(edge); if (!incoming.equals(rep)) _graph.addEdge(incoming, rep); } for (final DefaultEdge edge : _graph.outgoingEdgesOf(node)) { final ATermAppl outgoing = _graph.getEdgeTarget(edge); if (!outgoing.equals(rep)) _graph.addEdge(rep, outgoing); } _graph.removeVertex(node); } }
hprime.removeVertex(v);
public void destructiveTopologocialSort(final List<ATermAppl> nodesSorted) { final Queue<ATermAppl> nodesPending = createQueue(); for (final ATermAppl node : _graph.vertexSet()) if (_graph.outDegreeOf(node) == 0) nodesPending.add(node); while (!nodesPending.isEmpty()) { final ATermAppl node = nodesPending.remove(); assert _graph.outDegreeOf(node) == 0; nodesSorted.addAll(getAllEquivalents(node)); for (final DefaultEdge edge : _graph.incomingEdgesOf(node)) { final ATermAppl source = _graph.getEdgeSource(edge); if (_graph.outDegreeOf(source) == 1) nodesPending.add(source); } _graph.removeVertex(node); } assert _graph.vertexSet().isEmpty() : "Failed to sort elements: " + _graph.vertexSet(); } }
public void destructiveTopologocialSort(final List<ATermAppl> nodesSorted) { final Queue<ATermAppl> nodesPending = createQueue(); for (final ATermAppl node : _graph.vertexSet()) if (_graph.outDegreeOf(node) == 0) nodesPending.add(node); while (!nodesPending.isEmpty()) { final ATermAppl node = nodesPending.remove(); assert _graph.outDegreeOf(node) == 0; nodesSorted.addAll(getAllEquivalents(node)); for (final DefaultEdge edge : _graph.incomingEdgesOf(node)) { final ATermAppl source = _graph.getEdgeSource(edge); if (_graph.outDegreeOf(source) == 1) nodesPending.add(source); } _graph.removeVertex(node); } assert _graph.vertexSet().isEmpty() : "Failed to sort elements: " + _graph.vertexSet(); } }
gprime.removeVertex(v); vertexLabels.remove(v);
workingGraph.removeVertex(t); workingGraph.removeVertex(s);
public static boolean replaceVertex(Object oldVertex, Object newVertex) { if ((oldVertex == null) || (newVertex == null)) { return false; } Set<DefaultEdge> relatedEdges = completeGraph.edgesOf(oldVertex); completeGraph.addVertex(newVertex); Object sourceVertex; Object targetVertex; for (DefaultEdge e : relatedEdges) { sourceVertex = completeGraph.getEdgeSource(e); targetVertex = completeGraph.getEdgeTarget(e); if (sourceVertex.equals(oldVertex) && targetVertex.equals(oldVertex)) { completeGraph.addEdge(newVertex, newVertex); } else { if (sourceVertex.equals(oldVertex)) { completeGraph.addEdge(newVertex, targetVertex); } else { completeGraph.addEdge(sourceVertex, newVertex); } } } completeGraph.removeVertex(oldVertex); return true; } }
selfJoinGraph.removeVertex(aliasB);
/** * Removes the given vertex from the given graph. If the vertex to be removed has one or more * predecessors, the predecessors will be connected directly to the successors of the vertex to * be removed. * * @param graph graph to be mutated * @param vertex vertex to be removed from this graph, if present * @param <V> the graph vertex type * @param <E> the graph edge type * * @return true if the graph contained the specified vertex; false otherwise. */ public static <V, E> boolean removeVertexAndPreserveConnectivity(Graph<V, E> graph, V vertex) { if (!graph.containsVertex(vertex)) { return false; } if (vertexHasPredecessors(graph, vertex)) { List<V> predecessors = Graphs.predecessorListOf(graph, vertex); List<V> successors = Graphs.successorListOf(graph, vertex); for (V predecessor : predecessors) { addOutgoingEdges(graph, predecessor, successors); } } graph.removeVertex(vertex); return true; }