orientdb icon indicating copy to clipboard operation
orientdb copied to clipboard

Traverse all Vertices without removing duplicates

Open sivan123 opened this issue 10 years ago • 8 comments

I wasn't sure if a issue was raised to implement this feature, so raising one. This will be a very highly desirable feature to have. The current work arounds are ugly an inefficient( iterating and querying again within a loop from the java/javascript layer). Would be great to have the traverse query having the ability to return results without taking the dupes out.

Posting a thread from the google groups.

Luigi Dell'Aquila
01/06/2015

Hi Emil,

Traverse was implemented this way to avoid infinite loops, but now we know it's a limitation and we are thinking about a finer strategy, where the user can define (per single query) how traversed nodes have to be considered:

  • skip traversed nodes globally
  • skip traversed nodes in current path
  • never skip
  • other...

This feature is not tracked yet in the issue tracker, could you please open an issue about this?

Thanks

Luigi

Emin Agassi
01/06/2015

Hello All I am traversing a Graph that has some common Vertices. When I execute traverse, I only see one instance of the common Vertix versus several. For example,

A -> B C -> B

After traverse, I only see the following result:

A C B (common and pointed to by A and C)

I would like to see the duplicate Vertix in the result as follows:

A B (Common to A and C) C B (Common to A and C)

Is there a method to achieve this or Traverse always returns Distinct Vertices?

Thank you Emin

sivan123 avatar Mar 07 '16 05:03 sivan123

Hi @sivan123

Thank you very much, I think there was no other issue open about this.

Luigi

luigidellaquila avatar Mar 07 '16 09:03 luigidellaquila

Hi @luigidellaquila any plans to get this prioritized for an upcoming release?

sivan123 avatar Aug 09 '16 16:08 sivan123

hi @sivan123

We are re-writing the query executor for 3.0, so probably something will be done at that stage. In the meantime you can use the MATCH statement with the WHILE condition for that, it's much more flexible

http://orientdb.com/docs/2.2.x/SQL-Match.html#deep-traversal

Thanks

Luigi

luigidellaquila avatar Aug 10 '16 06:08 luigidellaquila

@luigidellaquila How does it look like currently? Is there any possibility to traverse all edges without cycle? I believe it's the same issue as this one: https://github.com/orientechnologies/orientdb/issues/6943

jgrabowski avatar Nov 20 '17 14:11 jgrabowski

Hi @jgrabowski

In v 3.0 we are extending the MATCH statement to also return the full path traversed on a WHILE condition and the depth, so you can use it for the same purpose of a TRAVERSE, but with more expression power.

Probably the TRAVERSE will remain as it is, but it should not be a big problem when you have a valid alternative.

Thanks

Luigi

luigidellaquila avatar Nov 20 '17 14:11 luigidellaquila

Thanks @luigidellaquila. Is it available right now in 3.0 M2? I can do some testing in this area.

jgrabowski avatar Nov 20 '17 15:11 jgrabowski

Hi @jgrabowski

I suggest you to try latest snapshot

https://oss.sonatype.org/content/repositories/snapshots/com/orientechnologies/orientdb-community/3.0.0-SNAPSHOT/

The new additions are depthAlias and pathAlias (See http://orientdb.com/docs/3.0.x/sql/SQL-Match.html)

Thanks

Luigi

luigidellaquila avatar Nov 20 '17 15:11 luigidellaquila

Hi @jgrabowski

This was released long time ago. I'm closing this issue, please feel free to re-open if you need further info

Thanks

Luigi

luigidellaquila avatar Jun 22 '18 15:06 luigidellaquila