A Graph traversal algorithm alternative to BFS

291 преглед
Пређи на прву непрочитану поруку

Mohsen Raeesi

непрочитано,
13. 2. 2018. 05:22:5913.2.18.
– Gremlin-users
Hi everyone,

I wanna to find the all n-distant path between two set of nodes (Source and Destination). As I check by profile() and explain() steps, Tinkerpop always uses BFS but it is not efficient. The efficient approach in my task is start from S and D together and try to find common nodes with distance of n/2.
for example I want to find all meta path "Author-->Paper-->Paper<--Paper<--Author" between two set of Authors ( A1:{x,y} and A2:{p,q} ), that is common references in A1's and A2's papers. assume that all nodes has 10 neighbors. BFS should visit more than 2 * 10,000 nodes to find the result, but the efficient traversal is:
  1. find all papers of x,y,p and q: 40 nodes.
  2. intersect between the references of these A1's paper and A2's paper: intersect between two set with less than 200 element.
the second approach reduce the traversals significantly, due to starting from limited part of query.

My questions:
  1. Is this approach is implemented in Tinkerpop yet?
  2. If no, how can I implement it?

Regards,
Mohsen

Mohsen Raeesi

непрочитано,
16. 2. 2018. 03:05:0416.2.18.
– Gremlin-users
Gremlin has no capability for bi-directional traversal?

Jean-Baptiste Musso

непрочитано,
16. 2. 2018. 09:16:5216.2.18.
– gremli...@googlegroups.com
For DFS, would the following help?

g.withoutStrategies(LazyBarrierStrategy, PathRetractionStrategy)
  .V() ... // proceed with DFS traversal
  
Quoting: "Remove strategies that will optimize for breadth first searches and thus allow Gremlin to go depth first."

Jean-Baptiste

--
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/e49d8036-46ea-458d-b6f2-fa73167ac82b%40googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

Mohsen Raeesi

непрочитано,
16. 2. 2018. 23:06:5416.2.18.
– gremli...@googlegroups.com
but I don't need DFS, I need "Bi-directional BFS".
It means we start BFS from source and destination at the same time, reducing nodes which should be traversed.

​Regards,​


--
You received this message because you are subscribed to a topic in the Google Groups "Gremlin-users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/gremlin-users/cJ1aO_aTx3Q/unsubscribe.
To unsubscribe from this group and all its topics, 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/CAC3-3jgTUSj2e7F7wnCiuUzM4_ka0kypNorxnK2ZOxwTQbOMFQ%40mail.gmail.com.

Robert Dale

непрочитано,
20. 2. 2018. 12:12:1620.2.18.
– gremli...@googlegroups.com
g.V(A1).out().out().fold().as('x').V(A2).out().out().where(within('x'))

Robert Dale

Mohsen Raeesi

непрочитано,
23. 2. 2018. 02:29:0023.2.18.
– gremli...@googlegroups.com
Thanks Robert,
Is it possible to do bi-directional BFS transparent by extending a Strategy or something like that?

Одговори свима
Одговори аутору
Проследи
0 нових порука