public boolean removeVertex( Process process ) { return graph.removeVertex( process ); }
protected void removeOrg(String oid, OperationResult opResult) throws Exception { repositoryService.deleteObject(OrgType.class, oid, opResult); orgGraph.removeVertex(oid); }
@Override public boolean removeVertex(V v) { boolean removed = super.removeVertex(v); if (removed) { /* * Depending on the topoOrderMap implementation, this can leave holes in the topological * ordering, which can degrade performance for certain operations over time. */ Integer topoIndex = topoOrderMap.removeVertex(v); // if possible contract minTopoIndex if (topoIndex == minTopoIndex) { while ((minTopoIndex < 0) && (topoOrderMap.getVertex(minTopoIndex) == null)) { ++minTopoIndex; } } // if possible contract maxTopoIndex if (topoIndex == maxTopoIndex) { while ((maxTopoIndex > 0) && (topoOrderMap.getVertex(maxTopoIndex) == null)) { --maxTopoIndex; } } ++topoModCount; } return removed; }
void removeObject(ObjectType objectType) throws Exception { repositoryService.deleteObject(objectType.getClass(), objectType.getOid(), new OperationResult("dummy")); synchronized(orgGraph) { if (objectType instanceof OrgType) { orgGraph.removeVertex(objectType.getOid()); } } }
protected void randomRemoveOrgStructure(OperationResult result) throws Exception { int count = 0; long totalTime = 0; List<String> vertices = new ArrayList<>(getVertices()); while (!vertices.isEmpty()) { int i = (int) Math.floor(vertices.size()*Math.random()); String oid = vertices.get(i); Class<? extends ObjectType> clazz = oid.startsWith("o") ? OrgType.class : UserType.class; // hack! try { repositoryService.deleteObject(clazz, oid, result); count++; totalTime += getNetDuration(); System.out.println("#" + count + ": " + oid + " deleted in " + getNetDuration() + " ms (net), remaining: " + (vertices.size() - 1)); } catch (Exception e) { System.err.println("Error deleting " + oid + ": " + e.getMessage()); } orgGraph.removeVertex(oid); vertices.remove(oid); if (count%getConfiguration().getDeletionsToClosureTest() == 0) { checkClosure(getVertices()); } } System.out.println(count + " objects deleted in avg time " + ((float) totalTime/count) + " ms (net)"); }
/** * Constructor for the NamedDAG * @param dag the DAG from which we want to keep only the named descriptions */ public static <T> SimpleDirectedGraph <T,DefaultEdge> getNamedDAG(EquivalencesDAG<T> dag) { SimpleDirectedGraph<T,DefaultEdge> namedDAG = new SimpleDirectedGraph<>(DefaultEdge.class); for (Equivalences<T> v : dag) namedDAG.addVertex(v.getRepresentative()); for (Equivalences<T> s : dag) for (Equivalences<T> t : dag.getDirectSuper(s)) namedDAG.addEdge(s.getRepresentative(), t.getRepresentative()); for (Equivalences<T> v : dag) if (!v.isIndexed()) { // eliminate node for (DefaultEdge incEdge : namedDAG.incomingEdgesOf(v.getRepresentative())) { T source = namedDAG.getEdgeSource(incEdge); for (DefaultEdge outEdge : namedDAG.outgoingEdgesOf(v.getRepresentative())) { T target = namedDAG.getEdgeTarget(outEdge); namedDAG.addEdge(source, target); } } namedDAG.removeVertex(v.getRepresentative()); // removes all adjacent edges as well } return namedDAG; }