Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

reconsider the uniqueness in go n steps [bidirectly] #2207

Closed
whitewum opened this issue Jul 3, 2020 · 2 comments
Closed

reconsider the uniqueness in go n steps [bidirectly] #2207

whitewum opened this issue Jul 3, 2020 · 2 comments
Labels
type/feature req Type: feature request

Comments

@whitewum
Copy link
Contributor

whitewum commented Jul 3, 2020

Consider a very simple example:
who is my friend of friend (fof), or who is my friend of a friend of friend (fofof...)?

By the first though, we could use go 2 steps from $me over friendship_edge.
But wait, does the sentence return and only return fof?
Q1. should the starting node (me) a fof?
Q2. can a (both 1-hop & 2-hop) friend be a fof too?

As the cypher spec said: "While pattern matching, Cypher makes sure to not include matches where the same graph relationship is found multiple times in a single pattern. ".

MATCH (user:User {name: 'Adam'})-[r1:FRIEND]-()-[r2:FRIEND]-(friend_of_a_friend) RETURN friend_of_a_friend.name AS fofName

or

match (a)-[r1:friend]->(b)-[r1:friend]->(c)
where not(a-[:friend]->(c))

or

g.V(123).out('friend").as('1-hopf').out('friend').except('1-hopf').dedup()

or

$myfriend = go from $me over friend yield distinct friend._dst As myfriend;
$fof = go from $-.myfriend over friend  yield distinct friend._dst AS fof;
$fof minus $myfriend;

2-hop is simple to think and explain in all the above languages.
But what's the behaviour about 4-hops friends, and the duplicated intermedia nodes?
IMO, I can't be a fof or fofofof for me.

@Shylock-Hg
Copy link
Contributor

If in a pure graph relationship query(not application specific). I think Q1 or Q2 is both yes.
But in specific case, if application require to remove the cyclic result , maybe we could provide a grammar to do it.

@whitewum
Copy link
Contributor Author

whitewum commented Jul 6, 2020

Another major problem is the returning size.
for some graph computing scenario, it fetches 2 to 4 hops neighbors.
As the returning latency is critical, if you consider "I am also a friend of friend", the returning size will be very very huge.
And the latency is not acceptable in the ad hoc query.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type/feature req Type: feature request
Projects
None yet
Development

No branches or pull requests

3 participants