from
) node and destination (to
) node can
be found using the keyword shortest
for the query block name. It requires the
source node UID, destination node UID and the predicates (at least one) that
have to be considered for traversal. A shortest
query block returns the
shortest path under _path_
in the query response. The path can also be stored
in a variable which is used in other query blocks.
numpaths: k
, and k > 1
, the
k-shortest paths are returned. Cyclical paths are pruned out from the result of
k-shortest path query. With depth: n
, the paths up to n
depth away are
returned.
shortest
block, no path can be fetched
as no edge is traversed.0x2
and 0x5
respectively) can be found with this query:
weight
facet, each edgesโ weight is considered as
1
numpaths
. Setting numpaths: 2
returns
the shortest two paths:
uid()
function. You can also combine it with GraphQL
Variables.facets
on the edges let you define the edgesโ weight as follows:
Car
or a Bus
.
Car
and Bus
:
numpaths
> 1) also accepts the
arguments minweight
and maxweight
, which take a float as their value. When
they are passed, only paths within the weight range [minweight, maxweight]
will be considered as valid paths. This can be used, for example, to query the
shortest paths that traverse between 2 and 4 nodes.
shortest
path block is allowed per query. Only one _path_
is
returned in the result. For queries with numpaths
> 1, _path_
contains all
the paths.numpaths
> 1), the result of the shortest path
query variable will only return a single path which will be the shortest path
among the k paths. All k paths are returned in _path_
.