### Question:
AnanasGraph { public Set<Step> topologicalSort() { return Graphs.topologicallySortedNodes(this.graph); } 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();  }### Answer:
@Test public void topologicalSort() { DagRequest dag = wikiDag(); AnanasGraph builder = new AnanasGraph(dag.dag, dag.goals); Set<Step> x = builder.topologicalSort(); Assert.assertEquals("should have same amout of step", dag.dag.getSteps().size(), x.size()); System.out.println(x.stream().map(s -> s.id).collect(Collectors.toList())); }