我正在尝试执行非常简单的社区检测代码,但它返回错误:
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))
^
答案 0 :(得分:0)
CommunityDetection
算法需要Graph
{1}} Ids和顶点值以及Long
边权重。在代码中,您可以为顶点和边定义Double
个值。
请查看at the Gelly documentation以获取更详细的使用信息。