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))
^
The
CommunityDetection
algorithm expects aGraph
withLong
Ids and vertex values andDouble
edge weights. In your code, you defineString
values for the vertices and the edges. Please, look at the Gelly documentation for more detailed usage information.