1
0
Fork 0
This commit is contained in:
Heiko 2019-05-06 15:52:01 +02:00 committed by Frank Celler
parent 26dc7f9a15
commit 8f5ea9b771
1 changed files with 41 additions and 38 deletions

View File

@ -432,48 +432,51 @@ var createKShortestPathsGraph = function() {
var graph = graph_module._create('shortestPathsGraph', [ var graph = graph_module._create('shortestPathsGraph', [
graph_module._relation('connections', 'places', ['places'])]); graph_module._relation('connections', 'places', ['places'])]);
var places = [ "Inverness" var places = [
, "Aberdeen" "Inverness",
, "Leuchars" "Aberdeen",
, "StAndrews" "Leuchars",
, "Edinburgh" "StAndrews",
, "Glasgow" "Edinburgh",
, "York" "Glasgow",
, "Carlisle" "York",
, "Birmingham" "Carlisle",
, "London" "Birmingham",
, "Brussels" "London",
, "Cologne" "Brussels",
, "Toronto" "Cologne",
, "Winnipeg" "Toronto",
, "Saskatoon" "Winnipeg",
, "Edmonton" "Saskatoon",
, "Jasper" "Edmonton",
, "Vancouver" ]; "Jasper",
"Vancouver"
];
var connections = [ var connections = [
[ "Inverness", "Aberdeen", 3, 2.5 ] [ "Inverness", "Aberdeen", 3, 2.5 ],
, [ "Aberdeen", "Leuchars", 1.5, 1 ] [ "Aberdeen", "Leuchars", 1.5, 1 ],
, [ "Leuchars", "Edinburgh", 1.5, 3 ] [ "Leuchars", "Edinburgh", 1.5, 3 ],
, [ "Edinburgh", "Glasgow", 1, 1 ] [ "Edinburgh", "Glasgow", 1, 1 ],
, [ "Edinburgh", "York", 3.5, 4 ] [ "Edinburgh", "York", 3.5, 4 ],
, [ "Glasgow", "Carlisle", 1, 1 ] [ "Glasgow", "Carlisle", 1, 1 ],
, [ "Carlisle", "York", 2.5, 3.5 ] [ "Carlisle", "York", 2.5, 3.5 ],
, [ "Carlisle", "Birmingham", 2.0, 1 ] [ "Carlisle", "Birmingham", 2.0, 1 ],
, [ "Birmingham", "London", 1.5, 2.5 ] [ "Birmingham", "London", 1.5, 2.5 ],
, [ "Leuchars", "StAndrews", 0.2, 0.2 ] [ "Leuchars", "StAndrews", 0.2, 0.2 ],
, [ "York", "London", 1.8, 2.0 ] [ "York", "London", 1.8, 2.0 ],
, [ "London", "Brussels", 2.5, 3.5 ] [ "London", "Brussels", 2.5, 3.5 ],
, [ "Brussels", "Cologne", 2, 1.5 ] [ "Brussels", "Cologne", 2, 1.5 ],
, [ "Toronto", "Winnipeg", 36, 35 ] [ "Toronto", "Winnipeg", 36, 35 ],
, [ "Winnipeg", "Saskatoon", 12, 5 ] [ "Winnipeg", "Saskatoon", 12, 5 ],
, [ "Saskatoon", "Edmonton", 12, 17 ] [ "Saskatoon", "Edmonton", 12, 17 ],
, [ "Edmonton", "Jasper", 6, 5 ] [ "Edmonton", "Jasper", 6, 5 ],
, [ "Jasper", "Vancouver", 12, 13 ] ]; [ "Jasper", "Vancouver", 12, 13 ]
];
for (p of places) { for (var p of places) {
graph.places.save({ _key: p, label: p}); graph.places.save({ _key: p, label: p});
} }
for (c of connections) { for (var c of connections) {
graph.connections.save('places/' + c[0], 'places/' + c[1], {'travelTime': c[2]}); graph.connections.save('places/' + c[0], 'places/' + c[1], {'travelTime': c[2]});
graph.connections.save('places/' + c[1], 'places/' + c[0], {'travelTime': c[3]}); graph.connections.save('places/' + c[1], 'places/' + c[0], {'travelTime': c[3]});
} }