This is a consistent behavior since a loong time. I think its a bug.
When you try finding a path from a node to itself using `astar` it throws exception when it should just return null. To verify: import org.neo4j.graphalgo.*; import org.neo4j.graphdb.*; import org.neo4j.graphdb.factory.GraphDatabaseFactory; import org.neo4j.kernel.impl.util.FileUtils; import java.io.File; import java.io.IOException; public class Main { private static final String DB_PATH = "target/neo4j-hello-db"; GraphDatabaseService graphDb; Node firstNode; Relationship relationship; private static enum RelTypes implements RelationshipType { KNOWS, LIKE } public static void main(final String[] args) { Main hello = new Main(); hello.clearDb(); hello.createDb(); hello.removeData(); hello.shutDown(); } void createDb() { clearDb(); // START SNIPPET: startDb graphDb = new GraphDatabaseFactory().newEmbeddedDatabase(DB_PATH); registerShutdownHook(graphDb); long l = System.currentTimeMillis(); Transaction tx = graphDb.beginTx(); try { firstNode = graphDb.createNode(); PathFinder<WeightedPath> finder2 = GraphAlgoFactory.aStar( PathExpanders.forTypeAndDirection(RelTypes.KNOWS, Direction.BOTH), new CostEvaluator<Double>() { @Override public Double getCost(Relationship relationship, Direction direction) { return 1d; } }, new EstimateEvaluator<Double>() { @Override public Double getCost(Node node, Node goal) { return 1d; } }); WeightedPath path = finder2.findSinglePath(firstNode, firstNode); tx.success(); } finally { tx.finish(); System.out.println(System.currentTimeMillis() - l); } } private void clearDb() { try { FileUtils.deleteRecursively(new File(DB_PATH)); } catch (IOException e) { throw new RuntimeException(e); } } void removeData() { Transaction tx = graphDb.beginTx(); try { firstNode.getSingleRelationship(RelTypes.KNOWS, Direction.OUTGOING).delete(); firstNode.delete(); tx.success(); } finally { tx.finish(); } } void shutDown() { System.out.println(); System.out.println("Shutting down database ..."); graphDb.shutdown(); } private static void registerShutdownHook(final GraphDatabaseService graphDb) { Runtime.getRuntime().addShutdownHook(new Thread() { @Override public void run() { graphDb.shutdown(); } }); } } -- 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 neo4j+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.