Hi Trevor,

note that the community detection algorithm returns a new graph where the
vertex values correspond to the computed communities. Also, note that the
current implementation expects a graph with java.lang.Long vertex values
and java.lang.Double edge values.

The following should work:

import java.lang.Long
import java.lang.Double

...

val graph: Graph[Long, Long, Double] = ... // create your graph
val resultGraph = graph.run(new CommunityDetection[Long](30, 0.5))
resultGraph.getVertices.print()


Cheers,
-Vasia.

On 27 April 2016 at 17:41, Suneel Marthi <smar...@apache.org> wrote:

> Recall facing a similar issue while trying to contribute a gelly-scala
> example to flink-training.
>
> See
> https://github.com/dataArtisans/flink-training-exercises/blob/master/src/main/scala/com/dataartisans/flinktraining/exercises/gelly_scala/PageRankWithEdgeWeights.scala
>
> On Wed, Apr 27, 2016 at 11:35 AM, Trevor Grant <trevor.d.gr...@gmail.com>
> wrote:
>
>> The following example in the scala shell worked as expected:
>>
>> import org.apache.flink.graph.library.LabelPropagation
>>
>> val verticesWithCommunity = graph.run(new LabelPropagation(30))
>>
>> // print the result
>> verticesWithCommunity.print
>>
>>
>> I tried to extend the example to use CommunityDetection:
>>
>> import org.apache.flink.graph.library.CommunityDetection
>>
>> val verticesWithCommunity = graph.run(new CommunityDetection(30, 0.5))
>>
>> // print the result
>> verticesWithCommunity.print
>>
>>
>> And meant the following error:
>> error: polymorphic expression cannot be instantiated to expected type;
>> found : [K]org.apache.flink.graph.library.CommunityDetection[K]
>> required: org.apache.flink.graph.GraphAlgorithm[Long,String,Double,?]
>> val verticesWithCommunity = graph.run(new CommunityDetection(30, 0.5))
>> ^
>>
>> I haven't been able to come up with a hack to make this work. Any
>> advice/bug?
>>
>> I invtestigated the code base a little, seems to be an issue with what
>> Graph.run expects to see vs. what LabelPropagation returns vs. what
>> CommunityDetection returns.
>>
>>
>>
>> Trevor Grant
>> Data Scientist
>> https://github.com/rawkintrevo
>> http://stackexchange.com/users/3002022/rawkintrevo
>> http://trevorgrant.org
>>
>> *"Fortunate is he, who is able to know the causes of things."  -Virgil*
>>
>>
>

Reply via email to