我试图执行一个非常简单的社区检测代码,但它返回一个错误:
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条答案
按热度按时间ehxuflar1#
这个
CommunityDetection
算法需要Graph
与Long
ID和顶点值以及Double
边权重。在代码中,定义String
顶点和边的值。请参阅gelly文档以获取更详细的用法信息。