neo4j/community — Issue #71: Dijkstra integer cost
Author: jadell
Created: 2011-10-22 01:37:56+00:00
State: open

The problem referenced in this forum post still seems to be an issue:

http://neo4j.org/forums/#nabble-td3077887

Basically, I have a bunch of relationships with a property "distance" that is an integer, and if I try to find a Dijkstra path using that property as the cost property, I get a Java exception: java.lang.Integer cannot be cast to java.lang.Double

Here's the stack trace:

[0] => org.neo4j.graphalgo.impl.util.DoubleEvaluator.getCost(DoubleEvaluator.java:38)
[1] => org.neo4j.graphalgo.impl.util.DoubleEvaluator.getCost(DoubleEvaluator.java:26)
[2] => org.neo4j.graphalgo.impl.path.Dijkstra$SelectorFactory.calculateValue(Dijkstra.java:100)
[3] => org.neo4j.graphalgo.impl.path.Dijkstra$SelectorFactory.calculateValue(Dijkstra.java:88)
[4] => org.neo4j.graphalgo.impl.util.BestFirstSelectorFactory$BestFirstSelector.next(BestFirstSelectorFactory.java:66)
[5] => org.neo4j.kernel.impl.traversal.TraverserImpl$TraverserIterator.fetchNextOrNull(TraverserImpl.java:127)
[6] => org.neo4j.kernel.impl.traversal.TraverserImpl$TraverserIterator.fetchNextOrNull(TraverserImpl.java:94)
[7] => org.neo4j.helpers.collection.PrefetchingIterator.hasNext(PrefetchingIterator.java:55)
[8] => org.neo4j.graphalgo.impl.util.StopAfterWeightIterator.fetchNextOrNull(StopAfterWeightIterator.java:45)
[9] => org.neo4j.graphalgo.impl.util.StopAfterWeightIterator.fetchNextOrNull(StopAfterWeightIterator.java:29)
[10] => org.neo4j.helpers.collection.PrefetchingIterator.hasNext(PrefetchingIterator.java:55)
[11] => org.neo4j.helpers.collection.IteratorWrapper.hasNext(IteratorWrapper.java:42)
[12] => org.neo4j.server.rest.repr.ListRepresentation.serialize(ListRepresentation.java:58)
[13] => org.neo4j.server.rest.repr.ListRepresentation.serialize(ListRepresentation.java:51)
[14] => org.neo4j.server.rest.repr.OutputFormat.format(OutputFormat.java:123)
[15] => org.neo4j.server.rest.repr.OutputFormat.response(OutputFormat.java:100)
[16] => org.neo4j.server.rest.repr.OutputFormat.ok(OutputFormat.java:48)
[17] => org.neo4j.server.rest.web.RestfulGraphDatabase.allPaths(RestfulGraphDatabase.java:1222)
[18] => sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[19] => sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
[20] => sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
[21] => java.lang.reflect.Method.invoke(Method.java:597)
[22] => com.sun.jersey.spi.container.JavaMethodInvokerFactory$1.invoke(JavaMethodInvokerFactory.java:60)
[23] => com.sun.jersey.server.impl.model.method.dispatch.AbstractResourceMethodDispatchProvider$ResponseOutInvoker._dispatch(AbstractResourceMethodDispatchProvider.java:205)
[24] => com.sun.jersey.server.impl.model.method.dispatch.ResourceJavaMethodDispatcher.dispatch(ResourceJavaMethodDispatcher.java:75)
[25] => com.sun.jersey.server.impl.uri.rules.HttpMethodRule.accept(HttpMethodRule.java:288)
[26] => com.sun.jersey.server.impl.uri.rules.RightHandPathRule.accept(RightHandPathRule.java:147)
[27] => com.sun.jersey.server.impl.uri.rules.ResourceClassRule.accept(ResourceClassRule.java:108)
[28] => com.sun.jersey.server.impl.uri.rules.RightHandPathRule.accept(RightHandPathRule.java:147)
[29] => com.sun.jersey.server.impl.uri.rules.RootResourceClassesRule.accept(RootResourceClassesRule.java:84)
[30] => com.sun.jersey.server.impl.application.WebApplicationImpl._handleRequest(WebApplicationImpl.java:1469)
[31] => com.sun.jersey.server.impl.application.WebApplicationImpl._handleRequest(WebApplicationImpl.java:1400)
[32] => com.sun.jersey.server.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:1349)
[33] => com.sun.jersey.server.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:1339)
[34] => com.sun.jersey.spi.container.servlet.WebComponent.service(WebComponent.java:416)
[35] => com.sun.jersey.spi.container.servlet.ServletContainer.service(ServletContainer.java:537)
[36] => com.sun.jersey.spi.container.servlet.ServletContainer.service(ServletContainer.java:699)
[37] => javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
[38] => org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:511)
[39] => org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1166)
[40] => org.neo4j.server.statistic.StatisticFilter.doFilter(StatisticFilter.java:62)
[41] => org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157)
[42] => org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:388)
[43] => org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:182)
[44] => org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:765)
[45] => org.mortbay.jetty.handler.HandlerCollection.handle(HandlerCollection.java:114)
[46] => org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152)
[47] => org.mortbay.jetty.Server.handle(Server.java:326)
[48] => org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:542)
[49] => org.mortbay.jetty.HttpConnection$RequestHandler.content(HttpConnection.java:943)
[50] => org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:756)
[51] => org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:218)
[52] => org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:404)
[53] => org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:410)
[54] => org.mortbay.thread.QueuedThreadPool$PoolThread.run(QueuedThreadPool.java:582)

This is over REST, if it makes any difference.

Thanks!

-- Josh Adell