[SGraph User Guide] Graph Construction Error

User 674 | 5/18/2015, 6:09:00 PM

Dear all, I was trying to construct a sgraph but failed with GrpahLab-Create server termination.

I am following the instruction for SDK here

For the sake of testing, I copy and pasted the sample code into a sg_extension.cpp.

` //sg_extension.cpp

include <graphlab/sdk/toolkitfunctionmacros.hpp>

include <graphlab/sdk/gl_sgraph.hpp>

using namespace graphlab;

glsgraph& constructgraph(){ glsgraph g; glsframe vertices { {"vid", {1,2,3}} }; glsframe edges {{"src", {1, 3}}, {"dst", {2, 2}}}; return g = g.addvertices(vertices, "vid").add_edges(edges, "src", "dst"); }

BEGINFUNCTIONREGISTRATION REGISTERFUNCTION(constructgraph); ENDFUNCTIONREGISTRATION ` Hoping that does the following in iPython will give me a sgraph back,

import graphlab as gl import sg_extension # This is the lib from sg_extension.cpp g = sg_extension.construct_graph()

However, instead of give a sgraph back to me, the GraphLab-Create server crashes. Some error messages are listed here:

` Unable to reach server for 3 consecutive pings. Server is considered dead. Please exit and restart.


RuntimeError Traceback (most recent call last) <ipython-input-3-02fd3c27e761> in <module>() ----> 1 g = sgextension.constructgraph()

/localdisk/qqiu/Envs/graphlab/lib/python2.7/site-packages/graphlab/extensions.pyc in <lambda>(*args, kwargs) 183 184 def makeinjected_function(fn, arguments): --> 185 return lambda *args, kwargs: runtoolkitfunction(fn, arguments, args, kwargs) 186 187 def classinstancefromname(classname, *arg, **kwarg):

/localdisk/qqiu/Envs/graphlab/lib/python2.7/site-packages/graphlab/extensions.pyc in runtoolkitfunction(fnname, arguments, args, kwargs) 168 # unwrap it 169 with cythoncontext(): --> 170 ret = gl.connect.main.getunity().runtoolkit(fnname, argumentdict) 171 # handle errors 172 if ret[0] != True:

/localdisk/qqiu/Envs/graphlab/lib/python2.7/site-packages/graphlab/cython/context.pyc in exit(self, exctype, excvalue, traceback) 29 def exit(self, exctype, excvalue, traceback): 30 if not self.showcythontrace and exctype: ---> 31 raise exctype(exc_value)

RuntimeError: Communication Failure: 113.

`

Summary:

I added some function in C++ SDK which intends to create a very simple sgraph however when invoked from iPython console the GraphLab Create server crashes on me.

So, my question is, what I did wrong here? Is this the correct way to have SDK create a sgraph for me? Thanks, Qiyuan Qiu

Comments

User 674 | 5/18/2015, 6:22:18 PM

Sorry everyone, I think there is an issue in my program. The return type of my program was wrong.

I wrote: gl_sgraph& construct_graph(){ //WRONG return type ... } Instead, I should write:

gl_sgraph construct_graph(){ //Correct return type ... }

So it is the & I missed. Sorry.