Github user manuzhang commented on a diff in the pull request:

    https://github.com/apache/incubator-gearpump/pull/223#discussion_r139049164
  
    --- Diff: core/src/main/scala/org/apache/gearpump/util/Graph.scala ---
    @@ -81,28 +86,35 @@ class Graph[N, E](vertexList: List[N], edgeList: 
List[(N, E, N)]) extends Serial
        * out degree
        */
       def outDegreeOf(node: N): Int = {
    -    edges.count(_._1 == node)
    +    outgoingEdgesOf(node).size
       }
     
       /**
        * in degree
        */
       def inDegreeOf(node: N): Int = {
    -    edges.count(_._3 == node)
    +    incomingEdgesOf(node).size
       }
     
       /**
        * out going edges.
        */
       def outgoingEdgesOf(node: N): List[(N, E, N)] = {
    -    edges.filter(_._1 == node)
    +    _outEdges.getOrElse(node, List.empty)
       }
     
       /**
        * incoming edges.
        */
       def incomingEdgesOf(node: N): List[(N, E, N)] = {
    -    edges.filter(_._3 == node)
    +    _inEdges.getOrElse(node, List.empty)
    +  }
    +
    +  /**
    +   * adjacent vertices.
    +   */
    +  def adjacentVertices(node: N): List[N] = {
    --- End diff --
    
    can this be private ? We don't know this is a DAG from outside.


---

Reply via email to