Skip to content
This repository was archived by the owner on Dec 13, 2023. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 18 additions & 1 deletion 3.7/aql/graphs-traversals.md
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,22 @@ FOR vertex[, edge[, path]]
duplicate edge
- "none" – no uniqueness check is applied on edges. **Note:**
Using this configuration the traversal will follow edges in cycles.
- **edgeCollections** (string\|array): Optionally restrict edge
collections the traversal may visit. 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.
- **vertexCollections** (string\|array): Optionally restrict vertex
collections the traversal may visit. 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
vertex collection.
- The starting vertex is always allowed, even if it does not belong to one
of the collections specified by a restriction.

### Working with collection sets

Expand All @@ -109,7 +125,8 @@ FOR vertex[, edge[, path]]

Instead of `GRAPH graphName` you may specify a list of edge collections. Vertex
collections are determined by the edges in the edge collections. The traversal
options are the same as with the [named graph variant](#working-with-named-graphs).
options are the same as with the [named graph variant](#working-with-named-graphs),
though the `edgeCollections` restriction option is redundant in this case.

If the same edge collection is specified multiple times, it will behave as if it
were specified only once. Specifying the same edge collection is only allowed when
Expand Down
27 changes: 27 additions & 0 deletions 3.7/release-notes-new-features37.md
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,33 @@ the graph, which can be expensive. In case it is known that only certain edges
from the named graph are needed, the `edgeCollections` option can be a handy
performance optimization.

### Traversal collection restrictions

Added traversal options `vertexCollections` and `edgeCollections` to restrict
traversal to certain vertex or edge collections.

The use case for `vertexCollections` is to not follow any edges that will point
to other than the specified vertex collections, e.g.

FOR v, e, p IN 1..3 OUTBOUND 'products/123' components
OPTIONS { vertexCollections: [ "bolts", "screws" ] }

The traversal's start vertex is always considered valid, regardless of whether
it is present in the `vertexCollections` option.

The use case for `edgeCollections` is to not take into consideration any edges
from edge collections other than the specified ones, e.g.

FOR v, e, p IN 1..3 OUTBOUND 'products/123' GRAPH 'components'
OPTIONS { edgeCollections: [ "productsToBolts", "productsToScrews" ] }

This is mostly useful in the context of named graphs, when the named graph
contains many edge collections. Not restricting the edge collections for the
traversal will make the traversal search for edges in all edge collections of
the graph, which can be expensive. In case it is known that only certain edges
from the named graph are needed, the `edgeCollections` option can be a handy
performance optimization.

### AQL functions added

The following AQL functions have been added in ArangoDB 3.7:
Expand Down