Date
1 - 6 of 6
hey guys ,how to query a person relational depth
李平 <lipin...@...>
I want to know ,one person in the janusGraph ,his relational depth,use gremlin |
|
Jason Plurad <plu...@...>
There's a recipe for this http://tinkerpop.apache.org/docs/current/recipes/#_maximum_depth On Wednesday, August 23, 2017 at 3:52:14 AM UTC-4, 李平 wrote:
|
|
李平 <lipin...@...>
gremlin> g.addV().property('name', 'A').as('a').
addV().property('phone', '110').as('b').
addV().property('name', 'C').as('c').
addV().property('phone', '111').as('d').
addV().property('name', 'E').as('e').
addV().property('phone', '112').as('f').
addV().property('name', 'G').as('g').
addE('hasPhone').from('a').to('b').
addE('hasPhone').from('c').to('d').
addE('hasPhone').from('c').to('b').
addE('hasPhone').from('e').to('d'). addE('hasPhone').from('e').to('f').
addE('hasPhone').from('g').to('b').iterate() if I want to know vertex A's relation depth how to write the gremlin commond, I write like this g.V().has('userId','1').repeat(__.as("a").out().in().where(neq("a"))).emit().path().count(local).max() but it seem endless loop, 在 2017年8月23日星期三 UTC+8下午9:16:21,Jason Plurad写道:
|
|
Jason Plurad <plu...@...>
Use simplePath() to avoid cycles http://tinkerpop.apache.org/docs/current/reference/#simplepath-step
On Wednesday, August 23, 2017 at 10:26:12 PM UTC-4, 李平 wrote:
|
|
Daniel Kuppitz <me@...>
Any of the following 2 queries should do the trick:
Pretty much depends on how you define "relation depth". Cheers, Daniel On Wed, Aug 23, 2017 at 7:26 PM, 李平 <lipin...@...> wrote:
|
|
李平 <lipin...@...>
ok thanks ,another question , how to skip a super vertex ,this vertex has lots of edge ,for example .the phone is 911 or this phone is custom service, so a lots of people has relation with this vertex , when I query a person two layer relation depth, it will query a lots of person
|
|