gearpump-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From manuzhang <...@git.apache.org>
Subject [GitHub] incubator-gearpump pull request #223: [GEARPUMP-349] Optimize Graph topologi...
Date Sat, 16 Sep 2017 07:06:32 GMT
Github user manuzhang commented on a diff in the pull request:

    https://github.com/apache/incubator-gearpump/pull/223#discussion_r139280373
  
    --- 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 --
    
    Is `topologicalOrderIterator` already sorted ? Why do we sort again ? 


---

Mime
View raw message