type mismatch flink graph community

131 views Asked by At

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

There are 1 answers

2
vasia On

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.