Traverse all possible N degree separation paths between vertexes

304 views
Skip to first unread message

lukey...@gmail.com

unread,
Aug 1, 2013, 3:29:23 PM8/1/13
to orient-...@googlegroups.com

We have a use case like this :  10M nodes and 30M edges (approx). 

I need to query like this. For any 2 vertexes find all 2 or 3 or 4 degrees possible paths between them.  2 degree separation like  V - E - V - E - V

What is the fastest solution supported by orientDB? How to do that in OrientDB queries? 


Luca Garulli

unread,
Aug 2, 2013, 12:36:49 PM8/2/13
to orient-database
Hi,
you could use the shortestPath() function like:

select shortestPath( #10:33, #33:22 )

Lvc@




--
 
---
You received this message because you are subscribed to the Google Groups "OrientDB" group.
To unsubscribe from this group and stop receiving emails from it, send an email to orient-databa...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

David Heryanto

unread,
Jun 26, 2015, 3:33:19 AM6/26/15
to orient-...@googlegroups.com
Hi Lvc

What if we want of find ALL paths between 2 vertices.
I tried using 'traverse' but it seems to only give unique paths between 2 vertices.
Also I find an example of using Gremlin to do so 

But I prefer to have an sql query to achieve that.

Thanks

Giulia Brignoli

unread,
Jun 26, 2015, 6:07:31 AM6/26/15
to orient-...@googlegroups.com
Hi David.

There isn't a function to return all the paths, but i have attached a java class that returns all paths between two nodes without considering cycles.

I hope you helpful.

Bye, Giulia
AllPath.java

David Heryanto

unread,
Jun 26, 2015, 9:13:55 AM6/26/15
to orient-...@googlegroups.com
Thanks Giulia :) I will give it a try. 

I hope the OrientDB developers may consider adding this feature in the future release. I think this can be useful in cases like link anomaly / fraudulent detection, for instance if the nodes represent sellers, suppliers, and merchandise, it may be interesting to see what are the possible paths that a seller can produce a merchandise.

Best
David

Luca Garulli

unread,
Jun 26, 2015, 1:32:03 PM6/26/15
to orient-...@googlegroups.com
Good idea, indeed!


Best Regards,

Luca Garulli
CEO at Orient Technologies LTD
the Company behind OrientDB

Best Regards,

Luca Garulli
CEO at Orient Technologies LTD
the Company behind OrientDB

--

---
You received this message because you are subscribed to the Google Groups "OrientDB" group.
To unsubscribe from this group and stop receiving emails from it, send an email to orient-databa...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages