public < T > DataSet < T > groupReduceOnEdges ( EdgesFunctionWithVertexValue < K , VV , EV , T > edgesFunction , EdgeDirection direction ) throws IllegalArgumentException { switch ( direction ) { case IN : return vertices . coGroup ( edges ) . where ( 0 ) . equalTo ( 1 ) . with ( new ApplyCoGroupFunction <> ( edgesFunction ) ) . name ( "GroupReduce on in-edges" ) ; case OUT : return vertices . coGroup ( edges ) . where ( 0 ) . equalTo ( 0 ) . with ( new ApplyCoGroupFunction <> ( edgesFunction ) ) . name ( "GroupReduce on out-edges" ) ; case ALL : return vertices . coGroup ( edges . flatMap ( new EmitOneEdgePerNode <> ( ) ) . name ( "Emit edge" ) ) . where ( 0 ) . equalTo ( 0 ) . with ( new ApplyCoGroupFunctionOnAllEdges <> ( edgesFunction ) ) . name ( "GroupReduce on in- and out-edges" ) ; default : throw new IllegalArgumentException ( "Illegal edge direction" ) ; } }
Groups by vertex and computes a GroupReduce transformation over the edge values of each vertex . The edgesFunction applied on the edges has access to both the id and the value of the grouping vertex .