diff --git a/e2e/shortest_path_test/test_k_weighted_shortest_paths_edges/input.cyp b/e2e/shortest_path_test/test_k_weighted_shortest_paths_edges/input.cyp new file mode 100644 index 000000000..900bff4f1 --- /dev/null +++ b/e2e/shortest_path_test/test_k_weighted_shortest_paths_edges/input.cyp @@ -0,0 +1,13 @@ +CREATE (:Node {id:1}); +CREATE (:Node {id:2}); +CREATE (:Node {id:3}); +CREATE (:Node {id:4}); +CREATE (:Node {id:5}); +MATCH (n1:Node {id:1}), (n2:Node{id:2}) CREATE (n1)-[:REL {weight:1, rel:"1 and 2"}]->(n2); +MATCH (n1:Node {id:1}), (n2:Node{id:3}) CREATE (n1)-[:REL {weight:4, rel:"1 and 3"}]->(n2); +MATCH (n1:Node {id:1}), (n2:Node{id:4}) CREATE (n1)-[:REL {weight:4, rel:"1 and 4"}]->(n2); +MATCH (n1:Node {id:2}), (n2:Node{id:3}) CREATE (n1)-[:REL {weight:1, rel:"2 and 3"}]->(n2); +MATCH (n1:Node {id:3}), (n2:Node{id:4}) CREATE (n1)-[:REL {weight:2, rel:"3 and 4"}]->(n2); +MATCH (n1:Node {id:3}), (n2:Node{id:5}) CREATE (n1)-[:REL {weight:2, rel:"3 and 5"}]->(n2); +MATCH (n1:Node {id:4}), (n2:Node{id:5}) CREATE (n1)-[:REL {weight:2, rel:"4 and 5"}]->(n2); +MATCH (n1:Node {id:1}), (n2:Node{id:5}) CREATE (n1)-[:REL {weight:3, rel:"1 and 5"}]->(n2); \ No newline at end of file diff --git a/e2e/shortest_path_test/test_k_weighted_shortest_paths_edges/test.yml b/e2e/shortest_path_test/test_k_weighted_shortest_paths_edges/test.yml new file mode 100644 index 000000000..b80b13a48 --- /dev/null +++ b/e2e/shortest_path_test/test_k_weighted_shortest_paths_edges/test.yml @@ -0,0 +1,20 @@ +query: > + MATCH (startNode:Node{id:1}) + WITH startNode + MATCH (endNode:Node{id:5}) + WITH startNode, endNode + CALL shortest_path.k_weighted_shortest_paths(startNode, endNode, 3, "weight") YIELD paths + WITH paths.path_edges AS edges + UNWIND edges AS edge + RETURN edge.rel AS rel + + + +output: + - rel: "1 and 5" # 1. path + - rel: "1 and 2" + - rel: "2 and 3" + - rel: "3 and 5" # 2. path + - rel: "1 and 3" + - rel: "3 and 5" # 3. path + diff --git a/e2e/shortest_path_test/test_k_weighted_shortest_paths_nodes/input.cyp b/e2e/shortest_path_test/test_k_weighted_shortest_paths_nodes/input.cyp new file mode 100644 index 000000000..768d19c89 --- /dev/null +++ b/e2e/shortest_path_test/test_k_weighted_shortest_paths_nodes/input.cyp @@ -0,0 +1,13 @@ +CREATE (:Node {id:1}); +CREATE (:Node {id:2}); +CREATE (:Node {id:3}); +CREATE (:Node {id:4}); +CREATE (:Node {id:5}); +MATCH (n1:Node {id:1}), (n2:Node{id:2}) CREATE (n1)-[:REL {weight:1}]->(n2); +MATCH (n1:Node {id:1}), (n2:Node{id:3}) CREATE (n1)-[:REL {weight:4}]->(n2); +MATCH (n1:Node {id:1}), (n2:Node{id:4}) CREATE (n1)-[:REL {weight:4}]->(n2); +MATCH (n1:Node {id:2}), (n2:Node{id:3}) CREATE (n1)-[:REL {weight:1}]->(n2); +MATCH (n1:Node {id:3}), (n2:Node{id:4}) CREATE (n1)-[:REL {weight:2}]->(n2); +MATCH (n1:Node {id:3}), (n2:Node{id:5}) CREATE (n1)-[:REL {weight:2}]->(n2); +MATCH (n1:Node {id:4}), (n2:Node{id:5}) CREATE (n1)-[:REL {weight:2}]->(n2); +MATCH (n1:Node {id:1}), (n2:Node{id:5}) CREATE (n1)-[:REL {weight:3}]->(n2); \ No newline at end of file diff --git a/e2e/shortest_path_test/test_k_weighted_shortest_paths_nodes/test.yml b/e2e/shortest_path_test/test_k_weighted_shortest_paths_nodes/test.yml new file mode 100644 index 000000000..db1b342f1 --- /dev/null +++ b/e2e/shortest_path_test/test_k_weighted_shortest_paths_nodes/test.yml @@ -0,0 +1,28 @@ +query: > + MATCH (startNode:Node{id:1}) + WITH startNode + MATCH (endNode:Node{id:5}) + WITH startNode, endNode + CALL shortest_path.k_weighted_shortest_paths(startNode, endNode, 5, "weight") YIELD paths + WITH paths.path_nodes AS nodes + UNWIND nodes AS node + RETURN node.id AS id + +output: + - id: 1 + - id: 5 # 1. path + - id: 1 + - id: 2 + - id: 3 + - id: 5 # 2. path + - id: 1 + - id: 3 + - id: 5 # 3. path + - id: 1 + - id: 4 + - id: 5 # 4. path + - id: 1 + - id: 2 + - id: 3 + - id: 4 + - id: 5 # 5. path \ No newline at end of file diff --git a/e2e/shortest_path_test/test_k_weighted_shortest_paths_weights/input.cyp b/e2e/shortest_path_test/test_k_weighted_shortest_paths_weights/input.cyp new file mode 100644 index 000000000..768d19c89 --- /dev/null +++ b/e2e/shortest_path_test/test_k_weighted_shortest_paths_weights/input.cyp @@ -0,0 +1,13 @@ +CREATE (:Node {id:1}); +CREATE (:Node {id:2}); +CREATE (:Node {id:3}); +CREATE (:Node {id:4}); +CREATE (:Node {id:5}); +MATCH (n1:Node {id:1}), (n2:Node{id:2}) CREATE (n1)-[:REL {weight:1}]->(n2); +MATCH (n1:Node {id:1}), (n2:Node{id:3}) CREATE (n1)-[:REL {weight:4}]->(n2); +MATCH (n1:Node {id:1}), (n2:Node{id:4}) CREATE (n1)-[:REL {weight:4}]->(n2); +MATCH (n1:Node {id:2}), (n2:Node{id:3}) CREATE (n1)-[:REL {weight:1}]->(n2); +MATCH (n1:Node {id:3}), (n2:Node{id:4}) CREATE (n1)-[:REL {weight:2}]->(n2); +MATCH (n1:Node {id:3}), (n2:Node{id:5}) CREATE (n1)-[:REL {weight:2}]->(n2); +MATCH (n1:Node {id:4}), (n2:Node{id:5}) CREATE (n1)-[:REL {weight:2}]->(n2); +MATCH (n1:Node {id:1}), (n2:Node{id:5}) CREATE (n1)-[:REL {weight:3}]->(n2); \ No newline at end of file diff --git a/e2e/shortest_path_test/test_k_weighted_shortest_paths_weights/test.yml b/e2e/shortest_path_test/test_k_weighted_shortest_paths_weights/test.yml new file mode 100644 index 000000000..617b3f3c2 --- /dev/null +++ b/e2e/shortest_path_test/test_k_weighted_shortest_paths_weights/test.yml @@ -0,0 +1,12 @@ +query: > + MATCH (startNode:Node{id:1}) + WITH startNode + MATCH (endNode:Node{id:5}) + WITH startNode, endNode + CALL shortest_path.k_weighted_shortest_paths(startNode, endNode, 3, "weight") YIELD paths + RETURN paths.weight AS weight + +output: + - weight: 3 + - weight: 4 + - weight: 6