@Test public void reverse() { DagRequest dag = wikiDag(); AnanasGraph original = new AnanasGraph(dag.dag, dag.goals); AnanasGraph reversed = original.reverse(); Assert.assertEquals(original.dag.connections.size(), reversed.dag.connections.size()); }
public AnanasGraph reverse() { Dag copy = this.dag.copy(); Set<DagEdge> edges = new HashSet<>(); for (DagEdge edge : copy.getConnections()) { edges.add(new DagEdge(edge.target, edge.source)); } copy.setConnections(edges); AnanasGraph dagGraphBuilder = new AnanasGraph(copy, this.goals); return dagGraphBuilder; }
AnanasGraph { public AnanasGraph reverse() { Dag copy = this.dag.copy(); Set<DagEdge> edges = new HashSet<>(); for (DagEdge edge : copy.getConnections()) { edges.add(new DagEdge(edge.target, edge.source)); } copy.setConnections(edges); AnanasGraph dagGraphBuilder = new AnanasGraph(copy, this.goals); return dagGraphBuilder; } }
AnanasGraph { public AnanasGraph reverse() { Dag copy = this.dag.copy(); Set<DagEdge> edges = new HashSet<>(); for (DagEdge edge : copy.getConnections()) { edges.add(new DagEdge(edge.target, edge.source)); } copy.setConnections(edges); AnanasGraph dagGraphBuilder = new AnanasGraph(copy, this.goals); return dagGraphBuilder; } AnanasGraph(Dag dag, Set<String> goals); }
AnanasGraph { public AnanasGraph reverse() { Dag copy = this.dag.copy(); Set<DagEdge> edges = new HashSet<>(); for (DagEdge edge : copy.getConnections()) { edges.add(new DagEdge(edge.target, edge.source)); } copy.setConnections(edges); AnanasGraph dagGraphBuilder = new AnanasGraph(copy, this.goals); return dagGraphBuilder; } AnanasGraph(Dag dag, Set<String> goals); AnanasGraph reverse(); Map<String, Iterable<Step>> DFSBranch(Set<String> leaves); Iterable<Step> DFSBranch(String stepId); Map<String, Iterable<Step>> DFSBranch(); AnanasGraph subDag(Set<String> leaves); Set<Step> topologicalSort(); Set<Step> successors(Step step); boolean isStartNode(Step step); Set<Step> predecessors(Step step); @Override String toString(); }
AnanasGraph { public AnanasGraph reverse() { Dag copy = this.dag.copy(); Set<DagEdge> edges = new HashSet<>(); for (DagEdge edge : copy.getConnections()) { edges.add(new DagEdge(edge.target, edge.source)); } copy.setConnections(edges); AnanasGraph dagGraphBuilder = new AnanasGraph(copy, this.goals); return dagGraphBuilder; } AnanasGraph(Dag dag, Set<String> goals); AnanasGraph reverse(); Map<String, Iterable<Step>> DFSBranch(Set<String> leaves); Iterable<Step> DFSBranch(String stepId); Map<String, Iterable<Step>> DFSBranch(); AnanasGraph subDag(Set<String> leaves); Set<Step> topologicalSort(); Set<Step> successors(Step step); boolean isStartNode(Step step); Set<Step> predecessors(Step step); @Override String toString();  }