Add stackoverflow answers TCK test suite
Reviewers: teon.banek, mferencevic, mculinovic, mtomic Reviewed By: teon.banek Subscribers: pullbot Differential Revision: https://phabricator.memgraph.io/D1412
This commit is contained in:
parent
366cd1fffc
commit
a1e4dc0268
@ -0,0 +1,30 @@
|
||||
Feature: Queries related to all Stackoverflow questions related to WSP
|
||||
|
||||
Scenario: Dijkstra with pre calculated cost
|
||||
|
||||
Given graph "wsp1"
|
||||
When executing query:
|
||||
"""
|
||||
MATCH (a {id: 1})-[
|
||||
edges *wShortest
|
||||
(e, n | (e.distance * 0.25) + (e.noise_level * 0.25) + (e.pollution_level * 0.5))
|
||||
total_weight
|
||||
]-(b {id: 4})
|
||||
RETURN startNode(head(edges)).id + reduce(acc = "", edge IN edges | acc + " -> " + endNode(edge).id) AS hops, total_weight;
|
||||
"""
|
||||
Then the result should be:
|
||||
| hops | total_weight |
|
||||
|'1 -> 2 -> 4'| 4.75 |
|
||||
|
||||
Scenario: Using more than one property Dijkstra
|
||||
|
||||
Given graph "wsp2"
|
||||
When executing query:
|
||||
"""
|
||||
MATCH (a {id: 1})-[edges *wShortest (e, n | e.weight1 + e.weight2) total_weight]-(b {id: 4})
|
||||
RETURN startNode(head(edges)).id + reduce(acc = "", edge IN edges | acc + " -> " + endNode(edge).id) AS hops, total_weight;
|
||||
"""
|
||||
Then the result should be:
|
||||
| hops | total_weight |
|
||||
|'1 -> 3 -> 4'| 17.0 |
|
||||
|
@ -0,0 +1,5 @@
|
||||
CREATE (n1 {id: 1}) CREATE (n2 {id: 2}) CREATE (n3 {id: 3}) CREATE (n4 {id: 4})
|
||||
CREATE (n1)-[:E {pollution_level: 1, distance: 1.0, noise_level: 5}]->(n2)
|
||||
CREATE (n1)-[:E {pollution_level: 2, distance: 2.0, noise_level: 4}]->(n3)
|
||||
CREATE (n2)-[:E {pollution_level: 3, distance: 2.0, noise_level: 3}]->(n4)
|
||||
CREATE (n3)-[:E {pollution_level: 4, distance: 1.0, noise_level: 2}]->(n4);
|
@ -0,0 +1,5 @@
|
||||
CREATE (n1 {id: 1}) CREATE (n2 {id: 2}) CREATE (n3 {id: 3}) CREATE (n4 {id: 4})
|
||||
CREATE (n1)-[:E {weight1: 1, weight2: 1}]->(n2)
|
||||
CREATE (n1)-[:E {weight1: 2, weight2: 10}]->(n3)
|
||||
CREATE (n2)-[:E {weight1: 3, weight2: 100}]->(n4)
|
||||
CREATE (n3)-[:E {weight1: 4, weight2: 1}]->(n4);
|
Loading…
Reference in New Issue
Block a user