-
Notifications
You must be signed in to change notification settings - Fork 28
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
99 additions
and
0 deletions.
There are no files selected for viewing
13 changes: 13 additions & 0 deletions
13
e2e/shortest_path_test/test_k_weighted_shortest_paths_edges/input.cyp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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); |
20 changes: 20 additions & 0 deletions
20
e2e/shortest_path_test/test_k_weighted_shortest_paths_edges/test.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 | ||
|
13 changes: 13 additions & 0 deletions
13
e2e/shortest_path_test/test_k_weighted_shortest_paths_nodes/input.cyp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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); |
28 changes: 28 additions & 0 deletions
28
e2e/shortest_path_test/test_k_weighted_shortest_paths_nodes/test.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
13 changes: 13 additions & 0 deletions
13
e2e/shortest_path_test/test_k_weighted_shortest_paths_weights/input.cyp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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); |
12 changes: 12 additions & 0 deletions
12
e2e/shortest_path_test/test_k_weighted_shortest_paths_weights/test.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |