cancel
Showing results for 
Search instead for 
Did you mean: 

Head's Up! Site maintenance this Wednesday, February 1. Disruptions expected as we migrate the forums.

Validation of the shortest path query

I have the network with (n:Nodes) and (r:Roads) with [:STARTS] and [:ENDS] rels (without any properties). The reason of this structure is adding objects like bridges, overpasses etc. to the r:Roads as another type of nodes. Because of that all of roads parameters are r:Roads properties:

{
  "identity": 403,
  "labels": [
    "Road"
  ],
  "properties": {
"maxAxleLoad": 115.0,
"kmRange": [
      552.905,
      561.716
    ],
"width": 7000,
"numbers": [
      "S8"
    ],
"name": "Gr. Woj. - Ostrów Mazowiecka",
"trafficFactor": 1.1313,
"lines": 2,
"type": "S",
"direction": "ONE_WAY"
  }
}

To evaluate which roads are passable I validate each of them and save IDs of these roads into a list (ommitedNode). After that, I request neo4j (v. 3.5) to build the shortest path by query without the impassable roads:

MATCH p=shortestPath((n1:Node)-[:STARTS|:ENDS*]-(n2:Node)) WHERE ID(n1) = 225 AND ID(n2) = 365 AND ALL (omittedNode in nodes(p) WHERE NOT id(omittedNode) in [202, 276, 309, 312, 313, 328, 494, 523, 527, 563, 582, 586, 587, 594, 704, 731]) AND LENGTH(p) > 0 UNWIND nodes(p) as nod RETURN nod as nod, ID(nod) as identity, head(labels(nod)) as type, nod.trafficFactor as trafficFactor, nod.latitude as latitude, nod.longitude as longitude, nod.kmRange as kmRange, nod.direction as direction

Of course the result based on the number of rels, but to use the neo4j technology I decided to find all of shortest path under f.e. 200 number of rels, collect them into a list and calculate their real length and directionaly correctness in Python later. Ok, so the query works and show me the shortest path like that:

After that I change the LENGTH(p) to lenght of the last shortest path to build another one, but longer. When neo4j reaches the specific point f.e. LENGTH(p) = 110 the neo4j not respond for the shortest path query at all (like on the picture):

My questions are following:

  1. Why neo4j not respond after a few of queries? The graph have about 7000 elements, but 347 nodes and 488 roads, so it seems that is not a complexed structure. Is it problem with a query or maybe computing capabilities of cloud server 1 x 2GHz?
  2. Why allShortestPaths query with LENGTH(p) > value respond only once (or not once) and calculating incessantly after using higher value?
  3. What is in the situation when 2 or more shortest paths have the same length, but I would like to find them by using the shortestpath query?

Generally, I would like to find all of the shortest paths without specific r:Roads and shorter then f.e. 200 number of rels into my network and I don't know how to do it correctly.

0 REPLIES 0