Oihana PHP Arango

TraversalOptions extends QueryOptions

Table of Contents

Constants

CACHE_ENABLED  : string = 'cacheEnabled'
DEDUPLICATE  : string = 'deduplicate'
DISABLE_INDEX  : string = 'disableIndex'
ESTIMATES  : string = 'estimates'
EXCLUSIVE  : string = 'exclusive'
EXPIRE_AFTER  : string = 'expireAfter'
FIELD_VALUE_TYPES  : string = 'fieldValueTypes'
FIELDS  : string = 'fields'
FORCE_INDEX_HINT  : string = 'forceIndexHint'
GEO_JSON  : string = 'geoJson'
IGNORE_ERRORS  : string = 'ignoreErrors'
IGNORE_REVS  : string = 'ignoreRevs'
IN_BACKGROUND  : string = 'inBackground'
INDEX_HINT  : string = 'indexHint'
KEEP_NULL  : string = 'keepNull'
LEGACY_POLYGONS  : string = 'legacyPolygons'
LOOKAHEAD  : string = 'lookahead'
MAX_PROJECTIONS  : string = 'maxProjections'
MERGE_OBJECTS  : string = 'mergeObjects'
METHOD  : string = 'method'
NAME  : string = 'name'
OVERWRITE_MODE  : string = 'overwriteMode'
PARALLELISM  : string = 'parallelism'
PARAMS  : string = 'params'
PREFIX_FIELDS  : string = 'prefixFields'
READ_OWN_WRITES  : string = 'readOwnWrites'
REFILL_INDEX_CACHES  : string = 'refillIndexCaches'
SPARSE  : string = 'sparse'
STORED_VALUE  : string = 'storedValue'
TYPE  : string = 'type'
UNIQUE  : string = 'unique'
USE_CACHE  : string = 'useCache'
WAIT_FOR_SYNC  : string = 'waitForSync'

Properties

$defaultWeight  : int|null
Specifies the default weight of an edge (number). The default value is 1.
$edgeCollections  : string|array<string|int, mixed>|null
Restrict edge collections the traversal may visit (string|array).
$indexHint  : object|null
You can provide index hints for traversals to let the optimizer prefer the vertex-centric indexes you specify over the regular edge index.
$maxProjections  : int|null
Specifies the number of document attributes per FOR loop to be used as projections (number).
$order  : string|null
Specify which traversal algorithm to use (string): - "bfs" – the traversal is executed breadth-first.
$parallelism  : int|null
Parallelize traversal execution (number).
$uniqueEdges  : string|null
Ensure edge uniqueness (string):
$uniqueVertices  : string|null
Ensure node uniqueness (string):
$useCache  : bool|null
Whether to use the in-memory cache for edges. The default is true.
$vertexCollections  : null|string|array<string|int, mixed>
Restrict node collections the traversal may visit (string|array).
$weightAttribute  : string|null
Specifies the name of an attribute that is used to look up the weight of an edge (string).

Methods

__construct()  : mixed
Creates a new QueryOptions instance.
jsonSerialize()  : array<string|int, mixed>
Invoked to serialize the object with the json serializer.

Constants

Properties

$edgeCollections

Restrict edge collections the traversal may visit (string|array).

public string|array<string|int, mixed>|null $edgeCollections

If omitted or an empty array is specified, then there are no restrictions.

A string parameter is treated as the equivalent of an array with a single element. Each element of the array should be a string containing the name of an edge collection.

Tags
see
https://docs.arangodb.com/stable/aql/graphs/traversals/#edgecollections

$indexHint

You can provide index hints for traversals to let the optimizer prefer the vertex-centric indexes you specify over the regular edge index.

public object|null $indexHint

This is useful for cases where the selectively estimate of the edge index is higher than the ones for suitable vertex-centric indexes (and thus they aren’t picked automatically) but the vertex-centric indexes are known to perform better.

The indexHint option expects an object in the following format:

{ "<edgeColl>": { "": { "": } } }

<edgeColl>: The name of an edge collection for which the index hint shall be applied. Collection names are case-sensitive. : The direction for which to apply the index hint. Valid values are inbound and outbound, in lowercase. You can specify indexes for both directions. : The level/depth for which the index should be applied. Valid values are the string base (to define the default index for all levels) and any stringified integer values greater or equal to zero. You can specify multiple levels. : The name of an index as a string, or multiple index names as a list of strings in the order of preference. The optimizer uses the first suitable index.

Tags
example
FOR v, e, p IN 1..4 OUTBOUND startNode edgeCollection
OPTIONS {
  indexHint: {
    "edgeCollection": {
      "outbound": {
        "base": ["edge"],
        "1": "myIndex1",
        "2": ["myIndex2", "myIndex1"],
        "3": "myIndex3",
      }
    }
  }
}
FILTER p.edges[1].foo == "bar" AND p.edges[2].foo == "bar" AND p.edges[2].baz == "qux"
see
https://docs.arangodb.com/stable/aql/graphs/traversals/#indexhint

$maxProjections

Specifies the number of document attributes per FOR loop to be used as projections (number).

public int|null $maxProjections

The default value is 5.

The AQL optimizer automatically detects which document attributes you access in traversal queries and optimizes the data loading.

This optimization is beneficial if you have large documents but only access a few document attributes. The maxProjections option lets you tune when to load individual attributes versus the whole document.

Tags
see
https://docs.arangodb.com/stable/aql/graphs/traversals/#maxprojections

$order

Specify which traversal algorithm to use (string): - "bfs" – the traversal is executed breadth-first.

public string|null $order

The results first contain all vertices at depth 1, then all vertices at depth 2 and so on.

  • "dfs" (default) – the traversal is executed depth-first. It first returns all paths from min depth to max depth for one vertex at depth 1, then for the next vertex at depth 1 and so on. "weighted" - the traversal is a weighted traversal (introduced in v3.8.0). Paths are enumerated with increasing cost. Also see weightAttribute and defaultWeight. A returned path has an additional attribute weight containing the cost of the path after every step. The order of paths having the same cost is non-deterministic. Negative weights are not supported and abort the query with an error.
Tags
see
https://docs.arangodb.com/stable/aql/graphs/traversals/#order

$parallelism

Parallelize traversal execution (number).

public int|null $parallelism

If omitted or set to a value of 1, the traversal execution is not parallelized. If set to a value greater than 1, then up to that many worker threads can be used for concurrently executing the traversal.

The value is capped by the number of available cores on the target machine.

Parallelizing a traversal is normally useful when there are many inputs (start nodes) that the nested traversal can work on concurrently. This is often the case when a nested traversal is fed with several tens of thousands of start nodes, which can then be distributed randomly to worker threads for parallel execution.

Tags
see
https://docs.arangodb.com/stable/aql/graphs/traversals/#parallelism

$uniqueVertices

Ensure node uniqueness (string):

public string|null $uniqueVertices
  • "path" – it is guaranteed that there is no path returned with a duplicate vertex
  • "global" – it is guaranteed that each vertex is visited at most once during the traversal, no matter how many paths lead from the start vertex to this one. If you start with a min depth > 1 a vertex that was found before min depth might not be returned at all (it still might be part of a path). It is required to set order: "bfs" or order: "weighted" because with depth-first search the results would be unpredictable. Note: Using this configuration the result is not deterministic any more. If there are multiple paths from startVertex to vertex, one of those is picked. In case of a weighted traversal, the path with the lowest weight is picked, but in case of equal weights it is undefined which one is chosen.
  • "none" (default) – no uniqueness check is applied on vertices
Tags
see
https://docs.arangodb.com/stable/aql/graphs/traversals/#uniquevertices

$vertexCollections

Restrict node collections the traversal may visit (string|array).

public null|string|array<string|int, mixed> $vertexCollections

If omitted or an empty array is specified, then there are no restrictions.

A string parameter is treated as the equivalent of an array with a single element. Each element of the array should be a string containing the name of a node collection. The starting node is always allowed, even if it does not belong to one of the collections specified by a restriction.

Tags
see
https://docs.arangodb.com/stable/aql/graphs/traversals/#vertexcollections

Methods

__construct()

Creates a new QueryOptions instance.

public __construct([array<string|int, mixed>|object|null $init = null ]) : mixed
Parameters
$init : array<string|int, mixed>|object|null = null

A generic object containing properties with which to populate the newly instance. If this argument is null, it is ignored.

jsonSerialize()

Invoked to serialize the object with the json serializer.

public jsonSerialize() : array<string|int, mixed>
Tags
throws
ReflectionException
Return values
array<string|int, mixed>
On this page

Search results