Bug in triple_apply: missing edge updates?

User 1867 | 5/6/2015, 7:28:55 AM

Hi, I'm working with the GraphLab Create SDK. I've created the following toy extension:

C++: ** glsgraph train(glsgraph& g) {

g = g.triple_apply( { triple.target["counter"] += triple.edge["v"]; }, {"counter"});

return g; ** Python:

**
g = SGraph() vertices = map(lambda i: Vertex(str(i) + "a", attr={'counter': 0.0}), xrange(5)) g = g.add_vertices(vertices)

edges = []
for i in xrange(5):
    for j in xrange(5):
        edges.append(Edge(str(i) + "a", str(j) + "a", attr={'v': .2}))
g = g.add_edges(edges)
g = my_extension_file.train(g)
print g.vertices

**

I expect that the resulting SFrame will have each vertex with a "counter" value of 1.0. And this does work for me. However, if I switch my triple_apply lambda to be this:

** glsgraph train(glsgraph& g) {

g = g.triple_apply( { triple.source["counter"] += triple.edge["v"]; }, {"counter"});

return g; **

(Notice the change from TARGET to SOURCE)

I get .8 on my SFrame counter values, while I expect the counter values to still be 1.0. What's going on?

Thanks!

Comments

User 1190 | 5/6/2015, 3:54:59 PM


User 1867 | 5/6/2015, 4:25:22 PM

But why is it inconsistent: why does it work one direction but not the other?


User 1190 | 5/8/2015, 7:28:35 AM

This is interesting, could be a bug. if you print out the source id and target id for each edge, and check the server log, you should see what's going on. I will also a take a look. Thanks for reporting.


User 1867 | 5/8/2015, 5:20:20 PM

By the way, the encoding of self-edges as vertex data works well, so thanks for that suggestion, although it can result in duplicated code in some cases. Not that the code inside of a triple_apply is ever really that long (or at least it prolly shouldnt' be), but it might still be something to keep in mind.

Thanks for all your help you guys have been great. We picked a project in GraphLab Create SDK to implement Hidden markov model representation and training algorithm for a class. Graph parallel framework is very exciting!