These are two unrelated APIs I presume you're using Neo4j server so I'd put your dijkstra code into a server extension an call it from the client passing in the id's from the outside to the extension.
The other option would be to use SDN 4.1.x with Neo4j embedded then you can both run the path-algo on embedded and also returns nodes from a query. But I'd prefer option 1, with Neo4j 3.0 you're be able to package it into a stored-proc which can also return nodes if need be. On Tue, Mar 1, 2016 at 7:41 PM, Johan Kumps <[email protected]> wrote: > Hi, > > I have to calculate the shortest path between 2 Nodes. I'm using Neo4J > 2.2.5 from within Spring Data. > > This is my code: > > PathFinder<WeightedPath> finder = GraphAlgoFactory > .dijkstra(PathExpanders.forTypeAndDirection(RelationshipTypes.SEM_SIM, > Direction.BOTH), > Constants.ADVERTISED_COST); > WeightedPath path = finder.findSinglePath(startVertexNode, goalVertexNode); > > The issue is how to get the Nodes. If I execute the query below: > > Map<String, Object> params = new HashMap<String, Object>(); > params.put( "id", 0 ); > String query = "MATCH n WHERE id(n) = {id} RETURN n"; > org.neo4j.ogm.session.result.Result result = > this.neo4jOperations.query(query, params); > > I get to the correct data but how can I convert the Result into a Node? Or > is there a more elegant way to get to the Node parameters needed for the > finder.findSinglePath method? > > Thanks in advance for helping me out! > > Kind regards, > Johan, > > -- > 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. > -- 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.
