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

151 lines
9.8 KiB
Plaintext

arangosh&gt; db._query(<span class="hljs-string">"FOR v, e IN OUTBOUND SHORTEST_PATH 'places/Aberdeen' TO 'places/London' GRAPH 'shortestPathsGraph' RETURN [v,e]"</span>);
[
[
{
<span class="hljs-string">"_key"</span> : <span class="hljs-string">"Aberdeen"</span>,
<span class="hljs-string">"_id"</span> : <span class="hljs-string">"places/Aberdeen"</span>,
<span class="hljs-string">"_rev"</span> : <span class="hljs-string">"_Yi4-H6O--_"</span>,
<span class="hljs-string">"label"</span> : <span class="hljs-string">"Aberdeen"</span>
},
<span class="hljs-literal">null</span>
],
[
{
<span class="hljs-string">"_key"</span> : <span class="hljs-string">"Leuchars"</span>,
<span class="hljs-string">"_id"</span> : <span class="hljs-string">"places/Leuchars"</span>,
<span class="hljs-string">"_rev"</span> : <span class="hljs-string">"_Yi4-H6S--_"</span>,
<span class="hljs-string">"label"</span> : <span class="hljs-string">"Leuchars"</span>
},
{
<span class="hljs-string">"_key"</span> : <span class="hljs-string">"98522"</span>,
<span class="hljs-string">"_id"</span> : <span class="hljs-string">"connections/98522"</span>,
<span class="hljs-string">"_from"</span> : <span class="hljs-string">"places/Aberdeen"</span>,
<span class="hljs-string">"_to"</span> : <span class="hljs-string">"places/Leuchars"</span>,
<span class="hljs-string">"_rev"</span> : <span class="hljs-string">"_Yi4-H7K--_"</span>,
<span class="hljs-string">"travelTime"</span> : <span class="hljs-number">1.5</span>
}
],
[
{
<span class="hljs-string">"_key"</span> : <span class="hljs-string">"Edinburgh"</span>,
<span class="hljs-string">"_id"</span> : <span class="hljs-string">"places/Edinburgh"</span>,
<span class="hljs-string">"_rev"</span> : <span class="hljs-string">"_Yi4-H6W--B"</span>,
<span class="hljs-string">"label"</span> : <span class="hljs-string">"Edinburgh"</span>
},
{
<span class="hljs-string">"_key"</span> : <span class="hljs-string">"98528"</span>,
<span class="hljs-string">"_id"</span> : <span class="hljs-string">"connections/98528"</span>,
<span class="hljs-string">"_from"</span> : <span class="hljs-string">"places/Leuchars"</span>,
<span class="hljs-string">"_to"</span> : <span class="hljs-string">"places/Edinburgh"</span>,
<span class="hljs-string">"_rev"</span> : <span class="hljs-string">"_Yi4-H7S--_"</span>,
<span class="hljs-string">"travelTime"</span> : <span class="hljs-number">1.5</span>
}
],
[
{
<span class="hljs-string">"_key"</span> : <span class="hljs-string">"York"</span>,
<span class="hljs-string">"_id"</span> : <span class="hljs-string">"places/York"</span>,
<span class="hljs-string">"_rev"</span> : <span class="hljs-string">"_Yi4-H6e--_"</span>,
<span class="hljs-string">"label"</span> : <span class="hljs-string">"York"</span>
},
{
<span class="hljs-string">"_key"</span> : <span class="hljs-string">"98540"</span>,
<span class="hljs-string">"_id"</span> : <span class="hljs-string">"connections/98540"</span>,
<span class="hljs-string">"_from"</span> : <span class="hljs-string">"places/Edinburgh"</span>,
<span class="hljs-string">"_to"</span> : <span class="hljs-string">"places/York"</span>,
<span class="hljs-string">"_rev"</span> : <span class="hljs-string">"_Yi4-H7e--_"</span>,
<span class="hljs-string">"travelTime"</span> : <span class="hljs-number">3.5</span>
}
],
[
{
<span class="hljs-string">"_key"</span> : <span class="hljs-string">"London"</span>,
<span class="hljs-string">"_id"</span> : <span class="hljs-string">"places/London"</span>,
<span class="hljs-string">"_rev"</span> : <span class="hljs-string">"_Yi4-H6m--B"</span>,
<span class="hljs-string">"label"</span> : <span class="hljs-string">"London"</span>
},
{
<span class="hljs-string">"_key"</span> : <span class="hljs-string">"98576"</span>,
<span class="hljs-string">"_id"</span> : <span class="hljs-string">"connections/98576"</span>,
<span class="hljs-string">"_from"</span> : <span class="hljs-string">"places/York"</span>,
<span class="hljs-string">"_to"</span> : <span class="hljs-string">"places/London"</span>,
<span class="hljs-string">"_rev"</span> : <span class="hljs-string">"_Yi4-H8C--_"</span>,
<span class="hljs-string">"travelTime"</span> : <span class="hljs-number">1.8</span>
}
]
]
[object ArangoQueryCursor, <span class="hljs-attr">count</span>: <span class="hljs-number">5</span>, <span class="hljs-attr">cached</span>: <span class="hljs-literal">false</span>, <span class="hljs-attr">hasMore</span>: <span class="hljs-literal">false</span>]
arangosh&gt; db._query(<span class="hljs-string">"FOR p IN OUTBOUND K_SHORTEST_PATHS 'places/Aberdeen' TO 'places/London' GRAPH 'shortestPathsGraph' LIMIT 1 RETURN p"</span>);
[
{
<span class="hljs-string">"edges"</span> : [
{
<span class="hljs-string">"_key"</span> : <span class="hljs-string">"98522"</span>,
<span class="hljs-string">"_id"</span> : <span class="hljs-string">"connections/98522"</span>,
<span class="hljs-string">"_from"</span> : <span class="hljs-string">"places/Aberdeen"</span>,
<span class="hljs-string">"_to"</span> : <span class="hljs-string">"places/Leuchars"</span>,
<span class="hljs-string">"_rev"</span> : <span class="hljs-string">"_Yi4-H7K--_"</span>,
<span class="hljs-string">"travelTime"</span> : <span class="hljs-number">1.5</span>
},
{
<span class="hljs-string">"_key"</span> : <span class="hljs-string">"98528"</span>,
<span class="hljs-string">"_id"</span> : <span class="hljs-string">"connections/98528"</span>,
<span class="hljs-string">"_from"</span> : <span class="hljs-string">"places/Leuchars"</span>,
<span class="hljs-string">"_to"</span> : <span class="hljs-string">"places/Edinburgh"</span>,
<span class="hljs-string">"_rev"</span> : <span class="hljs-string">"_Yi4-H7S--_"</span>,
<span class="hljs-string">"travelTime"</span> : <span class="hljs-number">1.5</span>
},
{
<span class="hljs-string">"_key"</span> : <span class="hljs-string">"98540"</span>,
<span class="hljs-string">"_id"</span> : <span class="hljs-string">"connections/98540"</span>,
<span class="hljs-string">"_from"</span> : <span class="hljs-string">"places/Edinburgh"</span>,
<span class="hljs-string">"_to"</span> : <span class="hljs-string">"places/York"</span>,
<span class="hljs-string">"_rev"</span> : <span class="hljs-string">"_Yi4-H7e--_"</span>,
<span class="hljs-string">"travelTime"</span> : <span class="hljs-number">3.5</span>
},
{
<span class="hljs-string">"_key"</span> : <span class="hljs-string">"98576"</span>,
<span class="hljs-string">"_id"</span> : <span class="hljs-string">"connections/98576"</span>,
<span class="hljs-string">"_from"</span> : <span class="hljs-string">"places/York"</span>,
<span class="hljs-string">"_to"</span> : <span class="hljs-string">"places/London"</span>,
<span class="hljs-string">"_rev"</span> : <span class="hljs-string">"_Yi4-H8C--_"</span>,
<span class="hljs-string">"travelTime"</span> : <span class="hljs-number">1.8</span>
}
],
<span class="hljs-string">"vertices"</span> : [
{
<span class="hljs-string">"_key"</span> : <span class="hljs-string">"Aberdeen"</span>,
<span class="hljs-string">"_id"</span> : <span class="hljs-string">"places/Aberdeen"</span>,
<span class="hljs-string">"_rev"</span> : <span class="hljs-string">"_Yi4-H6O--_"</span>,
<span class="hljs-string">"label"</span> : <span class="hljs-string">"Aberdeen"</span>
},
{
<span class="hljs-string">"_key"</span> : <span class="hljs-string">"Leuchars"</span>,
<span class="hljs-string">"_id"</span> : <span class="hljs-string">"places/Leuchars"</span>,
<span class="hljs-string">"_rev"</span> : <span class="hljs-string">"_Yi4-H6S--_"</span>,
<span class="hljs-string">"label"</span> : <span class="hljs-string">"Leuchars"</span>
},
{
<span class="hljs-string">"_key"</span> : <span class="hljs-string">"Edinburgh"</span>,
<span class="hljs-string">"_id"</span> : <span class="hljs-string">"places/Edinburgh"</span>,
<span class="hljs-string">"_rev"</span> : <span class="hljs-string">"_Yi4-H6W--B"</span>,
<span class="hljs-string">"label"</span> : <span class="hljs-string">"Edinburgh"</span>
},
{
<span class="hljs-string">"_key"</span> : <span class="hljs-string">"York"</span>,
<span class="hljs-string">"_id"</span> : <span class="hljs-string">"places/York"</span>,
<span class="hljs-string">"_rev"</span> : <span class="hljs-string">"_Yi4-H6e--_"</span>,
<span class="hljs-string">"label"</span> : <span class="hljs-string">"York"</span>
},
{
<span class="hljs-string">"_key"</span> : <span class="hljs-string">"London"</span>,
<span class="hljs-string">"_id"</span> : <span class="hljs-string">"places/London"</span>,
<span class="hljs-string">"_rev"</span> : <span class="hljs-string">"_Yi4-H6m--B"</span>,
<span class="hljs-string">"label"</span> : <span class="hljs-string">"London"</span>
}
],
<span class="hljs-string">"weight"</span> : <span class="hljs-number">4</span>
}
]
[object ArangoQueryCursor, <span class="hljs-attr">count</span>: <span class="hljs-number">1</span>, <span class="hljs-attr">cached</span>: <span class="hljs-literal">false</span>, <span class="hljs-attr">hasMore</span>: <span class="hljs-literal">false</span>]