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/Berlin",
"vertex" : {
"_id" : "frenchCity/Paris",
"_key" : "Paris",
"_rev" : "490333815",
"isCapital" : true,
"population" : 4000000
},
"paths" : [
{
"edges" : [
{
"_id" : "internationalHighway/491906679",
"_key" : "491906679",
"_rev" : "491906679",
"_from" : "germanCity/Berlin",
"_to" : "frenchCity/Paris",
"distance" : 1200
}
],
"vertices" : [
{
"_id" : "germanCity/Berlin",
"_key" : "Berlin",
"_rev" : "489350775",
"isCapital" : true,
"population" : 3000000
},
{
"_id" : "frenchCity/Paris",
"_key" : "Paris",
"_rev" : "490333815",
"isCapital" : true,
"population" : 4000000
}
]
}
],
"distance" : 1200
},
{
"startVertex" : "germanCity/Berlin",
"vertex" : {
"_id" : "frenchCity/Lyon",
"_key" : "Lyon",
"_rev" : "490137207",
"isCapital" : false,
"population" : 80000
},
"paths" : [
{
"edges" : [
{
"_id" : "internationalHighway/491710071",
"_key" : "491710071",
"_rev" : "491710071",
"_from" : "germanCity/Berlin",
"_to" : "frenchCity/Lyon",
"distance" : 1100
}
],
"vertices" : [
{
"_id" : "germanCity/Berlin",
"_key" : "Berlin",
"_rev" : "489350775",
"isCapital" : true,
"population" : 3000000
},
{
"_id" : "frenchCity/Lyon",
"_key" : "Lyon",
"_rev" : "490137207",
"isCapital" : false,
"population" : 80000
}
]
}
],
"distance" : 1100
},
{
"startVertex" : "germanCity/Hamburg",
"vertex" : {
"_id" : "frenchCity/Lyon",
"_key" : "Lyon",
"_rev" : "490137207",
"isCapital" : false,
"population" : 80000
},
"paths" : [
{
"edges" : [
{
"_id" : "germanHighway/491054711",
"_key" : "491054711",
"_rev" : "491054711",
"_from" : "germanCity/Hamburg",
"_to" : "germanCity/Cologne",
"distance" : 500
},
{
"_id" : "internationalHighway/492496503",
"_key" : "492496503",
"_rev" : "492496503",
"_from" : "germanCity/Cologne",
"_to" : "frenchCity/Lyon",
"distance" : 700
}
],
"vertices" : [
{
"_id" : "germanCity/Hamburg",
"_key" : "Hamburg",
"_rev" : "489743991",
"isCapital" : false,
"population" : 1000000
},
{
"_id" : "germanCity/Cologne",
"_key" : "Cologne",
"_rev" : "489547383",
"isCapital" : false,
"population" : 1000000
},
{
"_id" : "frenchCity/Lyon",
"_key" : "Lyon",
"_rev" : "490137207",
"isCapital" : false,
"population" : 80000
}
]
}
],
"distance" : 1200
},
{
"startVertex" : "germanCity/Hamburg",
"vertex" : {
"_id" : "frenchCity/Paris",
"_key" : "Paris",
"_rev" : "490333815",
"isCapital" : true,
"population" : 4000000
},
"paths" : [
{
"edges" : [
{
"_id" : "internationalHighway/492103287",
"_key" : "492103287",
"_rev" : "492103287",
"_from" : "germanCity/Hamburg",
"_to" : "frenchCity/Paris",
"distance" : 900
}
],
"vertices" : [
{
"_id" : "germanCity/Hamburg",
"_key" : "Hamburg",
"_rev" : "489743991",
"isCapital" : false,
"population" : 1000000
},
{
"_id" : "frenchCity/Paris",
"_key" : "Paris",
"_rev" : "490333815",
"isCapital" : true,
"population" : 4000000
}
]
}
],
"distance" : 900
},
{
"startVertex" : "germanCity/Cologne",
"vertex" : {
"_id" : "frenchCity/Paris",
"_key" : "Paris",
"_rev" : "490333815",
"isCapital" : true,
"population" : 4000000
},
"paths" : [
{
"edges" : [
{
"_id" : "internationalHighway/492693111",
"_key" : "492693111",
"_rev" : "492693111",
"_from" : "germanCity/Cologne",
"_to" : "frenchCity/Paris",
"distance" : 550
}
],
"vertices" : [
{
"_id" : "germanCity/Cologne",
"_key" : "Cologne",
"_rev" : "489547383",
"isCapital" : false,
"population" : 1000000
},
{
"_id" : "frenchCity/Paris",
"_key" : "Paris",
"_rev" : "490333815",
"isCapital" : true,
"population" : 4000000
}
]
}
],
"distance" : 550
},
{
"startVertex" : "germanCity/Cologne",
"vertex" : {
"_id" : "frenchCity/Lyon",
"_key" : "Lyon",
"_rev" : "490137207",
"isCapital" : false,
"population" : 80000
},
"paths" : [
{
"edges" : [
{
"_id" : "internationalHighway/492496503",
"_key" : "492496503",
"_rev" : "492496503",
"_from" : "germanCity/Cologne",
"_to" : "frenchCity/Lyon",
"distance" : 700
}
],
"vertices" : [
{
"_id" : "germanCity/Cologne",
"_key" : "Cologne",
"_rev" : "489547383",
"isCapital" : false,
"population" : 1000000
},
{
"_id" : "frenchCity/Lyon",
"_key" : "Lyon",
"_rev" : "490137207",
"isCapital" : false,
"population" : 80000
}
]
}
],
"distance" : 700
}
]
]