Skip to content

Commit

Permalink
[FLINK-1201] [gelly] filterOnVertices and filterOnEdges implemented a…
Browse files Browse the repository at this point in the history
…nd tested
  • Loading branch information
andralungu authored and StephanEwen committed Feb 11, 2015
1 parent ecb425d commit f4d2dda
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
Expand Up @@ -155,7 +155,7 @@ public Graph<K, VV, EV> subgraph(FilterFunction<VV> vertexFilter, FilterFunction
* @param vertexFilter * @param vertexFilter
* @return * @return
*/ */
public Graph<K, VV, EV> subgraphVertexPredicate(FilterFunction<VV> vertexFilter) { public Graph<K, VV, EV> filterOnVertices(FilterFunction<VV> vertexFilter) {


DataSet<Tuple2<K, VV>> filteredVertices = this.vertices.filter( DataSet<Tuple2<K, VV>> filteredVertices = this.vertices.filter(
new ApplyVertexFilter<K, VV>(vertexFilter)); new ApplyVertexFilter<K, VV>(vertexFilter));
Expand All @@ -176,7 +176,7 @@ public Graph<K, VV, EV> subgraphVertexPredicate(FilterFunction<VV> vertexFilter)
* @param edgeFilter * @param edgeFilter
* @return * @return
*/ */
public Graph<K, VV, EV> subgraphEdgePredicate(FilterFunction<EV> edgeFilter) { public Graph<K, VV, EV> filterOnEdges(FilterFunction<EV> edgeFilter) {
DataSet<Tuple3<K, K, EV>> filteredEdges = this.edges.filter( DataSet<Tuple3<K, K, EV>> filteredEdges = this.edges.filter(
new ApplyEdgeFilter<K, EV>(edgeFilter)); new ApplyEdgeFilter<K, EV>(edgeFilter));


Expand Down
Expand Up @@ -123,7 +123,7 @@ public static String runProgram(int progId, String resultPath) throws Exception
} }
case 4: { case 4: {
/* /*
* Test subgraph(vertexFilter, edgeFilter): * Test subgraph:
*/ */
final ExecutionEnvironment env = ExecutionEnvironment.getExecutionEnvironment(); final ExecutionEnvironment env = ExecutionEnvironment.getExecutionEnvironment();


Expand All @@ -146,13 +146,13 @@ public boolean filter(Long value) throws Exception {
} }
case 5: { case 5: {
/* /*
* Test subgraph(vertexFilter): * Test filterOnVertices:
*/ */
final ExecutionEnvironment env = ExecutionEnvironment.getExecutionEnvironment(); final ExecutionEnvironment env = ExecutionEnvironment.getExecutionEnvironment();


Graph<Long, Long, Long> graph = Graph.create(TestGraphUtils.getLongLongVertexData(env), Graph<Long, Long, Long> graph = Graph.create(TestGraphUtils.getLongLongVertexData(env),
TestGraphUtils.getLongLongEdgeData(env), env); TestGraphUtils.getLongLongEdgeData(env), env);
graph.subgraphVertexPredicate(new FilterFunction<Long>() { graph.filterOnVertices(new FilterFunction<Long>() {
public boolean filter(Long value) throws Exception { public boolean filter(Long value) throws Exception {
return (value > 2); return (value > 2);
} }
Expand All @@ -165,13 +165,13 @@ public boolean filter(Long value) throws Exception {
} }
case 6: { case 6: {
/* /*
* Test subgraph(edgeFilter): * Test filterOnEdges:
*/ */
final ExecutionEnvironment env = ExecutionEnvironment.getExecutionEnvironment(); final ExecutionEnvironment env = ExecutionEnvironment.getExecutionEnvironment();


Graph<Long, Long, Long> graph = Graph.create(TestGraphUtils.getLongLongVertexData(env), Graph<Long, Long, Long> graph = Graph.create(TestGraphUtils.getLongLongVertexData(env),
TestGraphUtils.getLongLongEdgeData(env), env); TestGraphUtils.getLongLongEdgeData(env), env);
graph.subgraphEdgePredicate(new FilterFunction<Long>() { graph.filterOnEdges(new FilterFunction<Long>() {
public boolean filter(Long value) throws Exception { public boolean filter(Long value) throws Exception {
return (value > 34); return (value > 34);
} }
Expand Down

0 comments on commit f4d2dda

Please sign in to comment.