类型不匹配flink图社区

时间:2016-08-26 22:50:48

标签: apache-flink flink-streaming gelly

我正在尝试执行非常简单的社区检测代码,但它返回错误:

import org.apache.flink.graph.library.CommunityDetection
import org.apache.flink.graph._
import org.apache.flink.graph.scala.Graph
import java.lang.Long
import java.lang.Double
import org.apache.flink.api.scala._

val env = ExecutionEnvironment.getExecutionEnvironment
val vertices = Seq(new Vertex[Long, String](1L, "foo"), new Vertex[Long, String](2L, "bar"))
val edges = Seq(new Edge[Long, String](1L, 2L, "foobar"))

val graph = Graph.fromCollection(vertices, edges, env)
val updatedGraph = graph.mapVertices(v => v.getValue + 1)
val resultGraph = graph.run(new CommunityDetection[Long](30, 0.5))


                            ^

1 个答案:

答案 0 :(得分:0)

CommunityDetection算法需要Graph {1}} Ids和顶点值以及Long边权重。在代码中,您可以为顶点和边定义Double个值。 请查看at the Gelly documentation以获取更详细的使用信息。