g.V(1).repeat(out()).until(outE().count().is(0)).path()
Get all the path from root to leaves which has at least one of the vertex from a vertexList.
g.V(1).repeat(out()).until(outE().count().is(0)).path().filter(unfold().is(within(vertexList)))
Get all such paths, where path contains at least half of the vertices from vertexList.
g.V(1).repeat(out()).until(outE().count().is(0)).path().filter(unfold().is(within(vertexList)).count().is(gte(vertexList.size() / 2)))
--
You received this message because you are subscribed to the Google Groups "Gremlin-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to gremlin-users+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/gremlin-users/64ed79e6-dd8b-4dd7-b683-65bd078050d1%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
g.V(128237704).repeat(out()).until(outE().count().is(0)).path()
Get all the path from root to leaves which has at least one of the vertex from a vertexList.g.V(1).repeat(out()).until(outE().count().is(0)).path().filter(unfold().is(within(vertexList)))Get all such paths, where path contains at least half of the vertices from vertexList.g.V(1).repeat(out()).until(outE().count().is(0)).path().filter(unfold().is(within(vertexList)).count().is(gte(vertexList.size() / 2)))Cheers,Daniel
On Mon, Sep 11, 2017 at 5:13 AM, surendra salke <surendr...@gmail.com> wrote:
Hi AllI have a tree with single root vertex(id=1), 600+ intermediate vertices and 300+ leavesI use the following query to get all the paths from a root node to the leaves
g.V(1).repeat(out()).until(outE().count().is(0)).path()Can you please help me with a following.if vertexList = [2,3,5,6]Get all the path from root to leaves which has at least one of the vertex from a vertexList.e.g path 1->2->4->6->9 should be selectedpath 1->4->7>12->17->22 should not be selectedGet all such paths, where path contains at least half of the vertices from vertexList.eng path 1->2->3->5->10 should be selected as this path has 5 virtices out of which 3 vertices(2,3,5) are from vertexList, (3/5 is greater than 0.5)path 1->5->6>12->17->22 should not be selected as this path has 6 virtices out of which 2 vertices(5,6) are from vertexList, (2/6 is not greater than 0.5)
--
You received this message because you are subscribed to the Google Groups "Gremlin-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to gremlin-user...@googlegroups.com.
To unsubscribe from this group and stop receiving emails from it, send an email to gremlin-users+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/gremlin-users/4e0aa1f4-7add-4cb0-b931-acd6a059724d%40googlegroups.com.
curl -X POST -d "{\"gremlin\":\"VId=[20,21,24,25]\\n g.V(1).repeat(out()).until(outE().count().is(0)).path().filter(unfold().is(within(VId)))\", \"language\":\"gremlin-groovy\"}" "http://localhost:8182"
gremlin> graph = TinkerGraph.open()==>tinkergraph[vertices:0 edges:0]gremlin> graph.io(IoCore.graphson()).readGraph("SampleGraph.json")Edge with id already exists: 1
To unsubscribe from this group and stop receiving emails from it, send an email to gremlin-users+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/gremlin-users/49a3cd05-6472-4607-8522-a30e75c92345%40googlegroups.com.
$ curl -X POST -d "{\"gremlin\":\"graph.io(IoCore.graphson()).readGraph('SampleGraph.json')\", \"language\":\"gremlin-groovy\"}" "http://localhost:8182" | python -m json.tool
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 253 100 138 100 115 492 410 --:--:-- --:--:-- --:--:-- 492
{
"requestId": "e43978bf-87f8-4819-a18e-d9bb3432590f",
"result": {
"data": [
null
],
"meta": {}
},
"status": {
"attributes": {},
"code": 200,
"message": ""
}
}
gremlin> g.V(128958600)==>v[128958600]
To unsubscribe from this group and stop receiving emails from it, send an email to gremlin-users+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/gremlin-users/4a4a8124-29cd-4a81-843d-4605148b4ceb%40googlegroups.com.
g.V(1).repeat(out()).until(outE().count().is(0)).path().filter(unfold().is(within(vertexList)).count().is(gte(Math.ceil(vertexList.size() / 2))))
gremlin> graph = TinkerGraph.open()
==>tinkergraph[vertices:0 edges:0]
gremlin> graph.io(IoCore.graphson()).readGraph("SampleGraph_v2.json")
==>null
gremlin> g = graph.traversal()
==>graphtraversalsource[tinkergraph[vertices:27 edges:26], standard]
gremlin> g.V(128950464).repeat(out()).until(outE().count().is(0)).path()
==>[v[128950464], v[252170352], v[251764808]]
==>[v[128950464], v[340029664], v[128958656]]
==>[v[128950464], v[251756616], v[251768904]]
==>[v[128950464], v[340025568], v[340230176]]
gremlin> vertexList= [252170352, 340029664]
==>252170352
==>340029664
gremlin> g.V(128950464).repeat(out()).until(outE().count().is(0)).path().filter(unfold().is(within(vertexList)))
gremlin> g.V(128950464).repeat(out()).until(outE().count().is(0)).path()
==>[v[128950464], v[252170352], v[251764808]]
==>[v[128950464], v[340029664], v[128958656]]
==>[v[128950464], v[251756616], v[251768904]]
==>[v[128950464], v[340025568], v[340230176]]
gremlin> g.V(128950464).repeat(out()).until(outE().count().is(0)).path().filter(unfold().is(within(vertexList)))
gremlin>
gremlin>
vertexList = [252170352, 340029664]g.V(128950464).repeat(out()).until(outE().count().is(0)).path().filter(unfold().hasId(within(vertexList)))
vertexList = g.V(252170352, 340029664).toLists()g.V(128950464).repeat(out()).until(outE().count().is(0)).path().filter(unfold().is(within(vertexList)))
To unsubscribe from this group and stop receiving emails from it, send an email to gremlin-users+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/gremlin-users/1f526cb1-b9f0-4ce3-943b-a378c4e12907%40googlegroups.com.
g.V(630824L).repeat(out()).until(outE().count().is(0)).path().filter(unfold().hasId(within(630824L)))
To view this discussion on the web visit https://groups.google.com/d/msgid/gremlin-users/d0fe3e6e-17d1-443b-b457-788911a63018%40googlegroups.com.To unsubscribe from this group and stop receiving emails from it, send an email to gremlin-users+unsubscribe@googlegroups.com.