DirectedGraph { public List<V> reverseTopologicalSort() { List<V> list = topologicalSort(); if (list == null) { return null; } Collections.reverse(list); return list; }  void addVertex(V vertex); boolean containsVertex(V vertex); void removeVertex(V vertex); void addEdge(V from, V to); void removeEdge(V from, V to); List<V> getNeighbors(V vertex); Map<V, Integer> outDegree(); Map<V, Integer> inDegree(); List<V> topologicalSort(); List<V> reverseTopologicalSort(); boolean isDag(); @Override String toString();  }
@Test public void reverseTopologicalSort() { List<Character> result = graph.reverseTopologicalSort(); List<Character> expected = Arrays.asList('C', 'G', 'F', 'B', 'A', 'E', 'D'); assertEquals(expected, result); }