SGraph User Guide Question:

User 674 | 5/14/2015, 3:52:54 PM

Deal all, In the Dato C++ SDK, there is a tutorial on how to create user defined graph structure. I have a question about the subgraph extraction part in section 1 Construction.

// g2 has edges 1->2, 2->3, 1->3
gl_sgraph g2 = gl_sgraph(g.vertices(),
                         g.edges()[g.edges()["__src_id"] < g.edges()["__dst_id"]]);

Here we have g.edges()[g.edges()["__src_id"] < g.edges()["__dst_id"]] as the second argument for the callable gl_sgraph(). In the bracket there is again g.edges()["__src_id"] < g.edges()["__dst_id"]. So basically, within the bracket there is a comparison.

Does the bracket here works as index into some maps? If so, how come the index operator can take a vector of results (from the comparison of two maps)?

Thanks, Qiyuan Qiu


User 91 | 5/14/2015, 6:08:12 PM

The operation is a logical filter: see for more details.

User 674 | 5/14/2015, 6:15:23 PM

Hi Srikris, Thanks for your attention.

I am still not quite sure I understand. The link you gave me is for Python right, so I guess having operations in the list is part of the language.

I was looking at this page when this problem arises. For the case of C++, the filter feature is not part of the language. Does Dato overload operator[] in that case?

Sorry for being slow here, Qiyuan Qiu

User 91 | 5/14/2015, 6:17:52 PM

Yes. The operator is overloaded. The code in the C++ layer looks very similar to what you might write in Python.

User 674 | 5/14/2015, 6:19:13 PM

I see, thanks for you time.