0
votes

I am trying to execute a very simple code for community detection but it returns an error:

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
Error:(30, 33) type mismatch; found : org.apache.flink.graph.library.CommunityDetection[Long] required: org.apache.flink.graph.GraphAlgorithm[Long,String,String,?] val resultGraph = graph.run(new CommunityDetection[Long](30, 0.5))Dzmitry Haikov

1 Answers

0
votes

The CommunityDetection algorithm expects a Graph with Long Ids and vertex values and Double edge weights. In your code, you define String values for the vertices and the edges. Please, look at the Gelly documentation for more detailed usage information.