gearpump-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From huafengw <...@git.apache.org>
Subject [GitHub] incubator-gearpump pull request #223: [GEARPUMP-349] Optimize Graph topologi...
Date Mon, 18 Sep 2017 06:47:42 GMT
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.


---

Mime
View raw message