public Process getEdgeTarget( ProcessEdge processEdge ) { return graph.getEdgeTarget( processEdge ); }
/** * */ @Override public Set<Equivalences<T>> getDirectSuper(Equivalences<T> v) { Set<Equivalences<T>> result = new LinkedHashSet<>(); for (DefaultEdge edge : dag.outgoingEdgesOf(v)) { Equivalences<T> source = dag.getEdgeTarget(edge); result.add(source); } return Collections.unmodifiableSet(result); }
/** * */ @Override public Set<Equivalences<T>> getDirectSuper(Equivalences<T> v) { Set<Equivalences<T>> result = new LinkedHashSet<>(); for (DefaultEdge edge : dag.outgoingEdgesOf(v)) { Equivalences<T> source = dag.getEdgeTarget(edge); result.add(source); } return Collections.unmodifiableSet(result); }
V v2 = graph.getEdgeTarget(v1OutEdge); for (E v2OutEdge : graph.outgoingEdgesOf(v2)) { V v3 = graph.getEdgeTarget(v2OutEdge);
for ( final DefaultEdge edge : outgoingEdges ) final List< Spot > successorBranch = branchGraph.getEdgeTarget( edge ); successors.add( successorBranch );
for ( final DefaultEdge edge : outgoingEdges ) final List< Spot > successorBranch = branchGraph.getEdgeTarget( edge ); successors.add( successorBranch );
protected void checkOrgGraph() throws SchemaException { OperationResult result = new OperationResult("temp"); int numberOfOrgsInRepo = repositoryService.countObjects(OrgType.class, null, null, result); info("Checking graph with repo. Orgs in repo: " + numberOfOrgsInRepo + ", orgs in graph: " + orgGraph.vertexSet().size()); assertTrue("# of orgs in repo (" + numberOfOrgsInRepo + ") is different from # of orgs in graph (" + orgGraph.vertexSet().size() + ")", numberOfOrgsInRepo == orgGraph.vertexSet().size()); for (String oid : orgGraph.vertexSet()) { //info("Checking " + oid); OrgType orgType; try { orgType = repositoryService.getObject(OrgType.class, oid, null, result).asObjectable(); } catch (ObjectNotFoundException|SchemaException e) { throw new AssertionError("Couldn't fetch " + oid, e); } assertTrue(orgGraph.vertexSet().contains(orgType.getOid())); Set<String> parentOidsInRepo = new HashSet<>(); for (ObjectReferenceType ort : orgType.getParentOrgRef()) { if (orgGraph.vertexSet().contains(ort.getOid())) { // i.e. the parent does exist parentOidsInRepo.add(ort.getOid()); } } Set<String> parentOidsInGraph = new HashSet<>(); for (DefaultEdge edge : orgGraph.outgoingEdgesOf(oid)) { parentOidsInGraph.add(orgGraph.getEdgeTarget(edge)); } assertEquals("Unexpected parentRefOrg set in " + orgType, parentOidsInGraph, parentOidsInRepo); } info("Graph is OK w.r.t. repo"); }
public DefaultDirectedGraph<T,DefaultEdge> getGraph() { if (graph == null) { graph = new DefaultDirectedGraph<>(DefaultEdge.class); for (Equivalences<T> node : dag.vertexSet()) { for (T v : node) graph.addVertex(v); for (T v : node) { graph.addEdge(v, node.getRepresentative()); graph.addEdge(node.getRepresentative(), v); } } for (DefaultEdge edge : dag.edgeSet()) graph.addEdge(dag.getEdgeSource(edge).getRepresentative(), dag.getEdgeTarget(edge).getRepresentative()); } return graph; }
public DefaultDirectedGraph<T,DefaultEdge> getGraph() { if (graph == null) { graph = new DefaultDirectedGraph<>(DefaultEdge.class); for (Equivalences<T> node : dag.vertexSet()) { for (T v : node) graph.addVertex(v); for (T v : node) { graph.addEdge(v, node.getRepresentative()); graph.addEdge(node.getRepresentative(), v); } } for (DefaultEdge edge : dag.edgeSet()) graph.addEdge(dag.getEdgeSource(edge).getRepresentative(), dag.getEdgeTarget(edge).getRepresentative()); } return graph; }
vertexList.indexOf(orgGraph.getEdgeTarget(edge)), 1.0);
/** * 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; }