Exercice2

This commit is contained in:
2025-10-23 12:08:18 +02:00
parent aae4dfc2ab
commit 95a745da35

View File

@@ -1,6 +1,6 @@
docker build -t mon-app .
http://localhost:3000
http://localhost:7474
@@ -21,19 +21,21 @@ SET p.nom = row.nom,
```
LOAD CSV WITH HEADERS FROM 'file:///routes.csv' AS row
WITH row
MATCH (a:Lieu {id: toInteger(row.source)})
MATCH (a:Point {id: toInteger(row.source)})
WITH a, row
MATCH (b:Lieu {id: toInteger(row.target)})
MATCH (b:Point {id: toInteger(row.target)})
MERGE (a)-[r:ROUTE {route_id: toInteger(row.route_id)}]->(b)
SET r.tag = row.tag, r.cout = toFloat(row.cout);
```
-- routes inverses si cout_inverse != -1
```
LOAD CSV WITH HEADERS FROM 'file:///routes.csv' AS row
WITH row
WHERE toFloat(row.cout_inverse) <> -1
MATCH (a:Lieu {id: toInteger(row.source)})
MATCH (a:Point {id: toInteger(row.source)})
WITH a, row
MATCH (b:Lieu {id: toInteger(row.target)})
MATCH (b:Point {id: toInteger(row.target)})
MERGE (b)-[r:ROUTE {route_id: toInteger(row.route_id) * 1000}]->(a)
SET r.tag = row.tag, r.cout = toFloat(row.cout_inverse);
```