1
0
Fork 0
arangodb/Documentation/Examples/generalGraphModuleShortestP...

270 lines
7.3 KiB
Plaintext

arangosh> var examples = require("org/arangodb/graph-examples/example-graph.js");
arangosh> var g = examples.loadGraph("routeplanner");
arangosh> g._shortestPath({}, {}, {weight : 'distance', endVertexCollectionRestriction : 'frenchCity',
........> startVertexCollectionRestriction : 'germanCity'});
[
[
{
"startVertex" : "germanCity/Hamburg",
"vertex" : {
"_id" : "frenchCity/Paris",
"_key" : "Paris",
"_rev" : "491873730",
"isCapital" : true,
"population" : 4000000
},
"paths" : [
{
"edges" : [
{
"_id" : "internationalHighway/493643202",
"_key" : "493643202",
"_rev" : "493643202",
"_from" : "germanCity/Hamburg",
"_to" : "frenchCity/Paris",
"distance" : 900
}
],
"vertices" : [
{
"_id" : "germanCity/Hamburg",
"_key" : "Hamburg",
"_rev" : "491283906",
"isCapital" : false,
"population" : 1000000
},
{
"_id" : "frenchCity/Paris",
"_key" : "Paris",
"_rev" : "491873730",
"isCapital" : true,
"population" : 4000000
}
]
}
],
"distance" : 900
},
{
"startVertex" : "germanCity/Hamburg",
"vertex" : {
"_id" : "frenchCity/Lyon",
"_key" : "Lyon",
"_rev" : "491677122",
"isCapital" : false,
"population" : 80000
},
"paths" : [
{
"edges" : [
{
"_id" : "germanHighway/492594626",
"_key" : "492594626",
"_rev" : "492594626",
"_from" : "germanCity/Hamburg",
"_to" : "germanCity/Cologne",
"distance" : 500
},
{
"_id" : "internationalHighway/494036418",
"_key" : "494036418",
"_rev" : "494036418",
"_from" : "germanCity/Cologne",
"_to" : "frenchCity/Lyon",
"distance" : 700
}
],
"vertices" : [
{
"_id" : "germanCity/Hamburg",
"_key" : "Hamburg",
"_rev" : "491283906",
"isCapital" : false,
"population" : 1000000
},
{
"_id" : "germanCity/Cologne",
"_key" : "Cologne",
"_rev" : "491087298",
"isCapital" : false,
"population" : 1000000
},
{
"_id" : "frenchCity/Lyon",
"_key" : "Lyon",
"_rev" : "491677122",
"isCapital" : false,
"population" : 80000
}
]
}
],
"distance" : 1200
},
{
"startVertex" : "germanCity/Cologne",
"vertex" : {
"_id" : "frenchCity/Lyon",
"_key" : "Lyon",
"_rev" : "491677122",
"isCapital" : false,
"population" : 80000
},
"paths" : [
{
"edges" : [
{
"_id" : "internationalHighway/494036418",
"_key" : "494036418",
"_rev" : "494036418",
"_from" : "germanCity/Cologne",
"_to" : "frenchCity/Lyon",
"distance" : 700
}
],
"vertices" : [
{
"_id" : "germanCity/Cologne",
"_key" : "Cologne",
"_rev" : "491087298",
"isCapital" : false,
"population" : 1000000
},
{
"_id" : "frenchCity/Lyon",
"_key" : "Lyon",
"_rev" : "491677122",
"isCapital" : false,
"population" : 80000
}
]
}
],
"distance" : 700
},
{
"startVertex" : "germanCity/Cologne",
"vertex" : {
"_id" : "frenchCity/Paris",
"_key" : "Paris",
"_rev" : "491873730",
"isCapital" : true,
"population" : 4000000
},
"paths" : [
{
"edges" : [
{
"_id" : "internationalHighway/494233026",
"_key" : "494233026",
"_rev" : "494233026",
"_from" : "germanCity/Cologne",
"_to" : "frenchCity/Paris",
"distance" : 550
}
],
"vertices" : [
{
"_id" : "germanCity/Cologne",
"_key" : "Cologne",
"_rev" : "491087298",
"isCapital" : false,
"population" : 1000000
},
{
"_id" : "frenchCity/Paris",
"_key" : "Paris",
"_rev" : "491873730",
"isCapital" : true,
"population" : 4000000
}
]
}
],
"distance" : 550
},
{
"startVertex" : "germanCity/Berlin",
"vertex" : {
"_id" : "frenchCity/Lyon",
"_key" : "Lyon",
"_rev" : "491677122",
"isCapital" : false,
"population" : 80000
},
"paths" : [
{
"edges" : [
{
"_id" : "internationalHighway/493249986",
"_key" : "493249986",
"_rev" : "493249986",
"_from" : "germanCity/Berlin",
"_to" : "frenchCity/Lyon",
"distance" : 1100
}
],
"vertices" : [
{
"_id" : "germanCity/Berlin",
"_key" : "Berlin",
"_rev" : "490890690",
"isCapital" : true,
"population" : 3000000
},
{
"_id" : "frenchCity/Lyon",
"_key" : "Lyon",
"_rev" : "491677122",
"isCapital" : false,
"population" : 80000
}
]
}
],
"distance" : 1100
},
{
"startVertex" : "germanCity/Berlin",
"vertex" : {
"_id" : "frenchCity/Paris",
"_key" : "Paris",
"_rev" : "491873730",
"isCapital" : true,
"population" : 4000000
},
"paths" : [
{
"edges" : [
{
"_id" : "internationalHighway/493446594",
"_key" : "493446594",
"_rev" : "493446594",
"_from" : "germanCity/Berlin",
"_to" : "frenchCity/Paris",
"distance" : 1200
}
],
"vertices" : [
{
"_id" : "germanCity/Berlin",
"_key" : "Berlin",
"_rev" : "490890690",
"isCapital" : true,
"population" : 3000000
},
{
"_id" : "frenchCity/Paris",
"_key" : "Paris",
"_rev" : "491873730",
"isCapital" : true,
"population" : 4000000
}
]
}
],
"distance" : 1200
}
]
]