graphX无法绘制多个边和顶点的图形?

时间:2016-04-08 17:42:53

标签: scala apache-spark spark-graphx

我的顶点类型是:

org.apache.spark.rdd.RDD[((Long, String), (Long, String), (Long, String))]

我的边缘类型是:

org.apache.spark.rdd.RDD[(org.apache.spark.graphx.Edge[String],org.apache.spark.graphx.Edge[String])]

当我尝试使用Graph(顶点,边)时。

它说:

<console>:47: error: type mismatch;
 found   : org.apache.spark.rdd.RDD[((Long, String), (Long, String), (Long, String))]
 required: org.apache.spark.rdd.RDD[(org.apache.spark.graphx.VertexId, ?)]

<console>:47: error: type mismatch;
 found   : org.apache.spark.rdd.RDD[(org.apache.spark.graphx.Edge[String], org.apache.spark.graphx.Edge[String])]
 required: org.apache.spark.rdd.RDD[org.apache.spark.graphx.Edge[?]]

(Long String)是tuple2。

1 个答案:

答案 0 :(得分:0)

我认为你必须纠正你的顶点和边缘rdd。

顶点rdd它是一个rdd [(VertexId,vertexValueType)]

因此您必须将顶点rdd更改为:

org.apache.spark.rdd.RDD[(VertexId, ((Long, String), (Long, String), (Long, String)))]

和edge rdd它是一个rdd [Edge [edgeValueType]] 确实应该是这样的:

org.apache.spark.rdd.RDD[org.apache.spark.graphx.Edge[String]]

也许您可以在实际创建此rdds的地方发布代码?