diff options
author | Reynold Xin <rxin@apache.org> | 2013-11-30 14:48:43 -0800 |
---|---|---|
committer | Reynold Xin <rxin@apache.org> | 2013-11-30 14:48:43 -0800 |
commit | 8e790b7f7ae8a1454b0312092cf32f072d587f9c (patch) | |
tree | 2a68cd1b5618f42ca3ae6171fbc9a75c965c77f4 /graph/src/test | |
parent | 229022891fead3a8addbd9f1fd10b250baa79676 (diff) | |
parent | 9e896be375a5c0270bbdf45a2532e59bcb813efa (diff) | |
download | spark-8e790b7f7ae8a1454b0312092cf32f072d587f9c.tar.gz spark-8e790b7f7ae8a1454b0312092cf32f072d587f9c.tar.bz2 spark-8e790b7f7ae8a1454b0312092cf32f072d587f9c.zip |
Merge branch 'subgraph-test' of github.com:ankurdave/graphx into clean1
Conflicts:
graph/src/main/scala/org/apache/spark/graph/impl/VertexPartition.scala
Diffstat (limited to 'graph/src/test')
-rw-r--r-- | graph/src/test/scala/org/apache/spark/graph/GraphSuite.scala | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/graph/src/test/scala/org/apache/spark/graph/GraphSuite.scala b/graph/src/test/scala/org/apache/spark/graph/GraphSuite.scala index 47b98cfd80..2a040de7fe 100644 --- a/graph/src/test/scala/org/apache/spark/graph/GraphSuite.scala +++ b/graph/src/test/scala/org/apache/spark/graph/GraphSuite.scala @@ -134,4 +134,15 @@ class GraphSuite extends FunSuite with LocalSparkContext { } } + test("subgraph") { + withSpark(new SparkContext("local", "test")) { sc => + val n = 10 + val star = Graph(sc.parallelize((1 to n).map(x => (0: Vid, x: Vid))), "defaultValue") + val subgraph = star.subgraph(vpred = (vid, attr) => vid % 2 == 0) + assert(subgraph.vertices.collect().toSet === + (0 to n / 2).map(x => (x * 2, "defaultValue")).toSet) + assert(subgraph.edges.collect().toSet === (1 to n / 2).map(x => Edge(0, x * 2)).toSet) + } + } + } |