Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dijkstra throws exception #7818

Closed
agarciaGIT opened this issue Oct 13, 2017 · 9 comments
Closed

dijkstra throws exception #7818

agarciaGIT opened this issue Oct 13, 2017 · 9 comments
Assignees
Labels

Comments

@agarciaGIT
Copy link

OrientDB Version: 2.2.9

Java Version: 1.8.0_111-b15

OS: Amazon Linux AMI 2016.09

Expected behavior

Running dijkstra will return the cheapest path between two vertices

Actual behavior

The dijkstra(#30:5, #39:3,'weight', 'both') call throws an error Error: java.lang.NullPointerException

Steps to reproduce

I have a simple graph where two vertices are connected by two other vertices via 4 edges forming a diamond. V1 <-E1- VA -E2-> V2 and V1 <-E3- VB -E4-> V2.

The dijkstra(#30:5, #39:3,'weight', 'both') call throws an error Error: java.lang.NullPointerException

@luigidellaquila
Copy link
Member

Hi @agarciaGIT

I just tried it with latest 2.2.29 and it seems to work fine.
I think this problem was fixed long time ago.

Could you please try to upgrade and, in case it still fails, post an SQL script to reproduce the problem?

Thanks

Luigi

@agarciaGIT
Copy link
Author

agarciaGIT commented Oct 27, 2017 via email

@luigidellaquila
Copy link
Member

Hi @agarciaGIT

Having the property on E class is definitely OK, that should not be the problem.
As the issue is easily reproducible on your DB, but not on other databases, is there any chance to have your DB (or a DB with the same issue) so that I can debug it locally?

Thanks

Luigi

@agarciaGIT
Copy link
Author

agarciaGIT commented Oct 27, 2017 via email

@luigidellaquila
Copy link
Member

Hi @agarciaGIT

I didn't get the attachment (GitHub does not allow to send them via email), could you please link it to the issue?

Thanks

Luigi

@agarciaGIT
Copy link
Author

OK, here.
SpinOffIntelligence (1).gz

@agarciaGIT
Copy link
Author

Here is a very simple DB with Just E and V where I have size and weight as Integers and astar and dijkstra both choose the more expensive path!

orientdb {db=SOI2}> SELECT dijkstra(#9:0, #9:1, size)

+----+----------------+
|# |dijkstra |
+----+----------------+
|0 |[#9:0,#9:2,#9:1]|
+----+----------------+

1 item(s) found. Query executed in 0.002 sec(s).
orientdb {db=SOI2}> SELECT astar(#9:0, #9:1, size)

+----+----------------+
|# |astar |
+----+----------------+
|0 |[#9:0,#9:2,#9:1]|
+----+----------------+

SOI2.gz

@luigidellaquila
Copy link
Member

Hi @agarciaGIT

I think I found the problem with the NullPointer, it happens when the source or the destination vertex do not exist. I'm fixing it now.
About your last comment, you have to quote the weight field name, eg.

SELECT dijkstra(#9:0, #9:1, "size")

I tested it locally and it works fine

Thanks

Luigi

@luigidellaquila
Copy link
Member

Hi @agarciaGIT

I just pushed a fix for the NPE.
Please feel free to re-open if you see other problems

Thanks

Luigi

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

No branches or pull requests

3 participants