Node parentNode = TridentUtils.getParent(graph, n); Set<IndexedEdge> outgoing = graph.outgoingEdgesOf(n); graph.removeVertex(n);
@Override public boolean removeVertex(V v) { return m_graph.removeVertex(v); }
public Collection<Object> getCycle() { long start = System.currentTimeMillis(); if (cycleDetector == null) { cycleDetector = new CycleDetector<>(graph); } Set<Object> cycles = cycleDetector.findCycles(); long delta = System.currentTimeMillis() - start; // System.out.println("Cycle output took " + delta + " msec"); for (Object vertex : cycles) { vertexReferenceCount.removeAll(vertex); graph.removeVertex(vertex); } return cycles; } }
public void applyLeave(EventBean[] eventsPerStream, ExprEvaluatorContext exprEvaluatorContext) { graph.removeEdge(eventsPerStream[0]); Object from = factory.getFrom().evaluate(eventsPerStream, true, exprEvaluatorContext); Object to = factory.getTo().evaluate(eventsPerStream, true, exprEvaluatorContext); if (vertexReferenceCount.remove(from)) { graph.removeVertex(from); } if (vertexReferenceCount.remove(to)) { graph.removeVertex(to); } }
@SuppressWarnings("unchecked") public InvalidationResult<STATE> invalidate(STATE state, RelationshipType relationshipType) { InvalidationResult<STATE> result = new InvalidationResult<STATE>(); // cascade changes to children (causal dependencies) of this task for (Edge edge : graph.edgesOf(state)) { if (edge.source().equals(state)) { // this vertex is coming FROM the invalid task, so cascade the invalidation. result.addAll(invalidate((STATE) edge.target(), ((RelationshipEdge) edge).getType())); } } // find the state's location AGENT agent = stateAgentReverseIndex.get(state); ITemporalSeries<STATE> temporalSeries = agentsTemporalSeries.get(agent); ITimePeriod timePeriod = stateTimePeriodIndex.get(state); if (relationshipType == RelationshipType.causal) { // for a causal relationship, the parent is invalid so this agent-state must be removed. // remove the state from all local data structures temporalSeries.remove(timePeriod.getEnd()); // use getEnd() because of exclusive-inclusive // semantics graph.removeVertex(state); stateAgentReverseIndex.remove(state); stateTimePeriodIndex.remove(state); } else { // for an influential relationship, some dependent data changed, so this agent-state must be // re-computed. // add it to the result collection to let the client decide how to proceed. result.add(RelationshipType.influential, state); } return result; }
Node parentNode = TridentUtils.getParent(graph, n); Set<IndexedEdge> outgoing = graph.outgoingEdgesOf(n); graph.removeVertex(n);