Community Detection in Graphlab Create

User 324 | 7/31/2014, 11:24:55 AM

I was wondering if Community Detection will become a topic for GraphLab Create soon? For Graphlab I found label propagation, is there a easy way to implement that for Create?

Kind regards, Alex


User 14 | 7/31/2014, 6:14:48 PM

It is easy to implement label propagation using triple_apply. Essentially you want to implement the following function:

<pre><code> def propagate(src, edge, dst): if dist(src, dst) < threshold: dst['label'] = src['label'] return src, edge, dst </code></pre>

Where dist can be your customized distance function. Then you can iteratively apply this function to the graph using tripleapply. I've included an example of implementing shortestpath, which is similar to label propagation, in another forum post here I hope it helps answer your question.

Thanks, -jay

User 324 | 8/5/2014, 11:42:32 AM

Thank you Jay for your answers. so I have to include this code into my dist: ?

Is it planned to include into the GraphlabCreate API anytime soon?

Kind regards, Alex

User 783 | 9/29/2014, 9:37:37 PM

Hi, guys, I am trying to use tripleapply the basic version indeed, but the code always stop at g = g.tripleapply(incrementdegree, mutatedfields=['degree']) and never pass it, could anyone give some advice?


from graphlab import SGraph, Vertex, Edge from graphlab import pagerank

def increment_degree(src, edge, dst): print "increment work" src['degree'] += 1 dst['degree'] += 1 print "increment work" return (src, edge, dst)

if name == "main":

g = SGraph()
verts = [Vertex(0, attr={'breed': 'labrador'}),
     Vertex(1, attr={'breed': 'labrador'}),
     Vertex(2, attr={'breed': 'vizsla'})]
#g = g.add_vertices(Vertex(1),Vertex(2))
g = g.add_edges(Edge(1,2))
g.vertices['degree'] = 0
print 'hello'
g = g.triple_apply(increment_degree, mutated_fields=['degree'])
print 'hello1'
print g.vertices.sort('degree', ascending=False)
print 'end'

User 18 | 9/30/2014, 8:51:46 PM

Hmm, I copied your code into a script (without the 'if name=="main"') but I can't replicate this problem. I used version 0.9.1. What version are you using? Also, did you install it in a virtualenv?