Github user huafengw commented on a diff in the pull request:
https://github.com/apache/incubator-gearpump/pull/223#discussion_r139345072
--- Diff: core/src/main/scala/org/apache/gearpump/util/Graph.scala ---
@@ -318,12 +360,8 @@ class Graph[N, E](vertexList: List[N], edgeList:
List[(N, E, N)]) extends Serial
* http://www.drdobbs.com/database/topological-sorting/184410262
*/
def topologicalOrderWithCirclesIterator: Iterator[N] = {
- if (hasCycle()) {
- val topo = getAcyclicCopy().topologicalOrderIterator
- topo.flatMap(_.sortBy(_indexs(_)).iterator)
- } else {
- topologicalOrderIterator
- }
+ val topo = getAcyclicCopy().topologicalOrderIterator
+ topo.flatMap(_.sortBy(indexs(_)).iterator)
--- End diff --
It's not. `topo` is an `Iterator[List[N]]` so the items of topo is sorted
but the item it self is a list and it's not sorted.
---