There is a bug <https://github.com/neo4j/neo4j/issues/2987> in 
GraphAlgoFactory (trivial but never the less irritating). Basically if you 
try finding a single shortest path from a node to itself, it gives 
following behavior:

Using  `GraphAlgoFactory.astar`, it throws:
org.neo4j.graphdb.NotFoundException: Relationship -1 not found

Using `GraphAlgoFactory.dijskstra`, it returns:
A Path starting (WeightedPath#startNode) from the node and ending 
(WeightedPath#endNode) at itself but with no relationship between them.

I looked at the source and found the bug in each and was rectifying it. But 
I am not sure what the behavior should be. 

Documentation 
<https://github.com/neo4j/neo4j/blob/master/community/graph-algo/src/main/java/org/neo4j/graphalgo/PathFinder.java>
 says 
that it should return null if no path is found. But for a path from a node 
to itself, should we assume it as a self-loop with no weight, given there 
is no explicit relationship between node to itself? Or is the behavior of 
`dijkstra` correct? (I think its wrong)

-- 
You received this message because you are subscribed to the Google Groups 
"Neo4j" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to