Regarding Neo4j Spatial, I'm curious if that was used to import the OSM
data in the first place? If so, the graph model you get is not ideal for
routing, or in fact any algorithm that searches for least cost paths, which
yours does. This is because the graph is the full OSM graph with all
intermediate nodes stored. You would want to make a routing graph with only
points of decision as nodes, and relationships between including the
distance (or in your case 'minutes'). Since your query already used
r.minutes, I'm guessing you have already done this.

Then I would say Michaels ideas are the best. The problem with a pure
Cypher query like your's is that it will produce all length 75 paths with a
one-direction depth first search, filtering on cost. With the graph
algorithms accessible through apoc, you could get a bi-directional bredth
first search which, while taking more memory to run, should also run faster
(if there is a path between S and E).

Michaels idea to use Neo4j Spatial to pre-filter the possible set of E
nodes to only those within a certain distance is also one way to reduce the
search space and speed things up before doing the path searches.

On Thu, Jul 7, 2016 at 3:36 PM, BalzaelRisingDark <gallegatimat...@gmail.com
> wrote:

> Hi everyone,
> I'm new in Neo4j world, I'm trying to elaborate isochrones in very large
> DB created from osm datas and loaded into Neo4j.
> Isochrones should be intended as: "All nodes reachable from a starting
> node within a certain time", in my db the nodes are for example the
> crossroads of a city and the relations are the streets with the time needed
> in minutes to go from a crossroad to another.
> I wrote something like this in cypher
>
> MATCH (S) WHERE S.osm_id="1683208894" //to find the starting node
> MATCH path = (S)-[*0..75]->(E)  //to find all nodes connected with a max
> of hops of 75 relations, if I do not put a limit it will calculate every
> possible path for every possible node in a 10GB db... not the best..
> WITH E,MIN( REDUCE(cost=0.0, r IN RELATIONSHIPS(path) | cost +
> toFloat(r.minutes)) ) AS cost //to calculate cost
> WHERE cost<15 //if i want only the isochrones of 15 min
> RETURN cost,collect(E) as isochrones
> ORDER BY cost
>
> The problem is that execution's time degenerate after 70 relations and 70
> is enough for isochrones of 12 minutes, I want to find at least 30 minutes
> isochrones.
> Is that possible in Cypher without waiting a year?
> Will be better if go for it by Java? Am I forced to write an apposite
> algorithm for this?
>
> THANKS!
> M.G.
>
> --
> 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.
>

-- 
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.

Reply via email to