kuzu icon indicating copy to clipboard operation
kuzu copied to clipboard

Getting Opposite (Non Existant) relations when using SHORTEST PATH queries

Open johnsmith765 opened this issue 10 months ago • 1 comments

I have twitter related data in my database which includes Tweets, Users, Hashtags etc , and I have relations that include Posts (User Posting a tweet), Mentions (Tweet mentioning a user), Tags (Tweet tagging a hashtag). Here are the relation tables

CREATE REL TABLE POSTS(FROM User TO Tweet)
CREATE REL TABLE MENTIONS(FROM Tweet TO User)
CREATE REL TABLE TAGS(FROM Tweet TO Hashtag)

When I run a query without path, I get correct results, for example

match (n:User {screen_name: $screen_name})-[r]-(m)
RETURN n,r,m,
LIMIT 10`

This gives my correct direction of edges, But when I try to find a shortest path between two users using the following query,

MATCH p = (u:User {screen_name: $source})-[r* ALL SHORTEST 1..30]-(t:User {screen_name: $target}) 
RETURN nodes(p) as nodes, rels(p) as edges LIMIT 5;

I get incorrect/opposite direction of edges, for example, Tweet posting a User, User mentioning a Tweet, But no rel table with such directions exists I am using Node.js library to query. Not sure if it is a bug or I am doing it wrong. Need some help. Best regards

johnsmith765 avatar Mar 28 '24 18:03 johnsmith765