When sending the same query (e.g. 'SELECT astar(#23:19965, #23:19187, 'length')') more than once, only the first result is correct. The consecutive results are longer and longer paths until it seems to either plateau or return no path at all.
So e.g. the shortest path contains 5 nodes.
The first query would return the 5 nodes. The second would return 10. Then 17. And then it returns 21 for every query past that point.
The problem seems to be, that in com.orientechnologies.orient.graph.sql.functions.OSQLFunctionAstar
'PriorityQueue
It seems like ...
... either .clear() should be called for 'open' and 'closedSet' before each execution
... or a new instance of OSQLFunctionAstar should be created, every time the function is executed.
This is not the case with Dijkstra's algorithm, because a new instance of A* is created each time.
Hi @martineutinger , @luigidellaquila
yes i detect some bugs in the astar function too (null checking and etc ) . i check it asap .
Thank you @saeedtabrizi, I'll check it as well
Thanks!
Luigi
Hi @martineutinger , @luigidellaquila
I fix some bugs (reported bug) and more test to astar function now . i will push it asap .
Great, thank you very much @saeedtabrizi !
Looking forward to the pr!
Thanks
Luigi
@luigidellaquila the bugs fixed now .
Thank you @saeedtabrizi.
So does that mean the single-astar-instance-per-server is by design?
Dear @martineutinger , Short answer is Yes in the current version . but i planned to add and implement some useful and more efficient path finding functions like the Block A , Hybrid A , CH , CRP for OrientDB asap .
As we know path-finding algorithms is so useful to Robotic , Intelligence Traffic Management, Routing for the smart vehicle systems and some similar applications.

I'm glad if i hear from @lvca , @luigidellaquila and i create an issue for proposal path-finding .
+100!
Hi @martineutinger
I just pushed a fix for this. Thank you very much @saeedtabrizi for the contribution!
Luigi
@luigidellaquila Thanks to solve the root of problem .
Noted in the Release Notes
Most helpful comment
+100!