Use case: Get all the edges of a node, grouped by the label and also group the otherV by the label, display name, and counts for both.
Graph has the following nodes: post, product, company. post has outE named review which goes to both product and company.
For a postid, is there a way to get the count of reviews grouped by product and company.
I would like to display in a table the following info.
postid | review (count) | product (count) postid | review (count) | company (count)
I tried outE()
, out()
with groupby
label but I cannot seem to construct a query that will give me the counts with multiple groupby
's.
Any help would be most appreciated.
Thanks in advance.
graph = TinkerGraph.open()
g = graph.traversal()
v1 = graph.addVertex(id, 1, label, "post")
v2 = graph.addVertex(id, 2, label, "company")
v3 = graph.addVertex(id, 3, label, "company")
v4 = graph.addVertex(id, 4, label, "product")
v5 = graph.addVertex(id, 5, label, "product")
v1.addEdge("reviews", v2)
v1.addEdge("reviews", v3)
v1.addEdge("reviews", v4)
v1.addEdge("reviews", v5)