orientechnologies / orientdb

OrientDB is the most versatile DBMS supporting Graph, Document, Reactive, Full-Text and Geospatial models in one Multi-Model product. OrientDB can run distributed (Multi-Master), supports SQL, ACID Transactions, Full-Text indexing and Reactive Queries.
https://orientdb.dev
Apache License 2.0
4.74k stars 871 forks source link

New function shortestPaths() #4474

Closed lvca closed 3 years ago

lvca commented 9 years ago

shortestPaths(from, to, { labels: [

We need a function that returns multiple shortest paths, ordered by shortness. limit is the maximum number of shortest paths you want to retrieve.

Unduli commented 9 years ago

My apologies in advance if not proper place but,

I'd also appreciate if Dijkstra function also allows you to specify mandatory vertices and/or subpaths.

Edit : Seems I posted reply incomplete, surprised that someone understood it. I was asking for a Dijkstras() function returning multiple paths as well.

lvca commented 9 years ago

@Unduli WDYT about creating a new issue with the detail of what you're looking for?

jmdavid commented 9 years ago

This is a must! Is there a chance to have this function integrated before 2.2? Is it too late for 2.1?

voxadam commented 9 years ago

I ran across this while digging through the issues database after a sleepless night (I blame @lvca for creating OrientDB in the first place).

Anyways, @Unduli's reply about an implementation of Dijkstra's algorithm in addition to shortestPaths() got me thinking. Would someone more familiar with the internal intricacies and implementation of OrientDB be willing to write up a draft of "best practices" for the implementing algorithms like the ones being talked about here for use in OrientDB?

Release quality documentation isn't necessary, I'd be more that willing to take even a rough sketch proof, expand, and generally get the addition into a state where it could be included in the official developer documentation.

lvca commented 9 years ago

@voxadam I hope you're blaming my name anymore :-) @luigidellaquila is working to the new pattern matching, probably he's the right guy to ask for this guide. Nice idea.

gg4u commented 9 years ago

Hi, testing shortestPath() (no ShortestPaths).

I obtained only one results linking between two vertexes; but there should be more paths of the same length.

I read ShortestPaths will return more paths ordered by shortness. Does shortestPath return multiple paths of the same shortest length or just one and only result?

pkoppstein commented 8 years ago

As best I can tell, currently (e.g. In 2.1.7) there is no way to determine, in general, the edges corresponding to the shortest path that is found by any of the shortest-path builtins. This seems to be a major oversight, but perhaps it can be remedied relatively easily, e.g. by adding a parameter so that the shortest path functions can be instructed to return vertices and edges. (Alternatively, variant functions could be added, e.g. shortestRoute(s).)

(I came across a stackoverflow post by Luca (https://stackoverflow.com/questions/28346044/orientdb-edges-in-shortestpath) in which he wrote that shortestpath() returns edges (i.e., as well as nodes). That is not the case in 2.1.7, but if that's a bug in 2.1.7, so be it.)