Open antejavor opened 7 months ago
Implementation of a K-shortest path algorithm based on Yen K Shortest path implementation.
Correctness test so far:
MATCH (n) DETACH DELETE n; CREATE CONSTRAINT ON (n:Node) ASSERT n.id IS UNIQUE; 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); 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) YIELD paths RETURN paths // CALL shortest_path.k_weighted_shortest_paths(startNode, endNode, 5, "weight") YIELD paths RETURN paths
Results:
(id: 171, :Node, properties: {id: 1}) (id: 175, :Node, properties: {id: 5}) Path: 3.000000 (id: 171, :Node, properties: {id: 1}) (id: 172, :Node, properties: {id: 2}) (id: 173, :Node, properties: {id: 3}) (id: 175, :Node, properties: {id: 5}) Path: 4.000000 (id: 171, :Node, properties: {id: 1}) (id: 173, :Node, properties: {id: 3}) (id: 175, :Node, properties: {id: 5}) Path: 6.000000 (id: 171, :Node, properties: {id: 1}) (id: 174, :Node, properties: {id: 4}) (id: 175, :Node, properties: {id: 5}) Path: 6.000000 (id: 171, :Node, properties: {id: 1}) (id: 172, :Node, properties: {id: 2}) (id: 173, :Node, properties: {id: 3}) (id: 174, :Node, properties: {id: 4}) (id: 175, :Node, properties: {id: 5}) Path: 6.000000
TODO:
######################################
The SonarCloud Quality Gate passed, but some issues were introduced.
4 New issues 0 Security Hotspots No data about Coverage 0.0% Duplication on New Code
See analysis details on SonarCloud
Description
Implementation of a K-shortest path algorithm based on Yen K Shortest path implementation.
Correctness test so far:
Results:
TODO:
Pull request type
######################################
Reviewer checklist (the reviewer checks this part)
Module/Algorithm
######################################