cancel
Showing results for 
Search instead for 
Did you mean: 

Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.

Using Neo4j with geo data

I have a question about your database. You have implemented a Dijkstra-search of paths between nodes in your database. We have this problem – each edge have its restrictions for example “the edge is disabled during weekends” or “the edge is available between 08:00 – 22:00 UTC” or “the edge is available if you started at this point X or going to the point Y, otherwise it’s closed” some other conditions.

So that means that it finds a different path on week days and weekends, after 22:00 and before 08:00.

Is it possible to implement such restrictions for our GEO-data in Neo4j?

Ivan

3 REPLIES 3

The question you ask related to the 'Graph Algorithms' topic where the Dijkstra algorithm is discussed. I have changed the category to increase the chances of you finding people with the knowledge to help. You might also want to change the title of the question, because Dijkstra is only distantly related to geo-spatial. In particular, the constraint you described, with an edge disabled during certain time periods, sounds more like a temporal restriction, with no spatial component at all.

I have also just reviewed the documentation at https://neo4j.com/docs/graph-algorithms/current/algorithms/shortest-path/, and I see that there is a section 6.2.7 which describes a way to restrict the path using Cypher queries, in which case you could add a relationshipQuery which takes into account the valid times of the edge.

You could either add a boolean to the edge which you change each day, or you could add an active wday range and query that dynamically in the relationshipQuery.

Thank you very much, I will check it.

Looks like Cypher Projection may help. Load subset of graph based on your conditions and then try running algo.
https://neo4j.com/docs/graph-algorithms/current/algorithms/shortest-path/#algorithms-shortest-path-c...