类型不匹配的flink图社区

zaqlnxep  于 2021-06-25  发布在  Flink
关注(0)|答案(1)|浏览(309)

我试图执行一个非常简单的社区检测代码,但它返回一个错误:

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))

                            ^
ehxuflar

ehxuflar1#

这个 CommunityDetection 算法需要 GraphLong ID和顶点值以及 Double 边权重。在代码中,定义 String 顶点和边的值。请参阅gelly文档以获取更详细的用法信息。

相关问题