@@ -117,6 +117,58 @@ All collections in the list that do not specify their own direction use the
117117direction defined after ` IN ` (here: ` OUTBOUND ` ). This allows using a different
118118direction for each collection in your path search.
119119
120+ ### Graph path searches in a cluster
121+
122+ Due to the nature of graphs, edges may reference nodes from arbitrary
123+ collections. Following the paths can thus involve documents from various
124+ collections and it is not possible to predict which are visited in a path
125+ search - unless you use named graphs that define all node and edge collections
126+ that belong to them and the graph data is consistent.
127+
128+ If you use anonymous graphs / collection sets for graph queries, which node
129+ collections need to be loaded by the graph engine can deduced automatically if
130+ there is a named graph with a matching edge collection in its edge definitions
131+ (introduced in v3.12.6). Edge collections are always declared explicitly in
132+ queries, directly or via referencing a named graph.
133+
134+ Without a named graph, the involved node collections can only be determined at
135+ run time. Use the [ ` WITH ` operation] ( ../high-level-operations/with.md ) to
136+ declare the node collections upfront. This is required for path searches
137+ using collection sets in cluster deployments (if there is no named graph to
138+ deduce the node collections from). Declare the collection of the start node as
139+ well if it's not declared already (like by a ` FOR ` loop).
140+
141+ For example, suppose you have two node collections, ` person ` and ` movie ` , and
142+ an ` acts_in ` edge collection that connects them. If you want to run a path search
143+ query that starts (and ends) at a person that you specify with its document ID,
144+ you need to declare both node collections at the beginning of the query:
145+
146+ ``` aql
147+ WITH person, movie
148+ FOR p IN ANY ALL_SHORTEST_PATHS "person/1544" TO "person/52560" acts_in
149+ RETURN p.vertices[*].label
150+ ```
151+
152+ However, if there is a named graph that includes an edge definition for the
153+ ` acts_in ` edge collection, with ` person ` as the _ from_ collection and ` movie `
154+ as the _ to_ collection, you can omit ` WITH person, movie ` . That is, if you
155+ specify ` acts_in ` as an edge collection in an anonymous graph query, all
156+ named graphs are checked for this edge collection, and if there is a matching
157+ edge definition, its node collections are automatically added as data sources to
158+ the query.
159+
160+ ``` aql
161+ FOR p IN ANY ALL_SHORTEST_PATHS "person/1544" TO "person/52560" acts_in
162+ RETURN p.vertices[*].label
163+
164+ // Chris Rock --> Dogma <-- Ben Affleck --> Surviving Christmas <-- Jennifer Morrison
165+ // Chris Rock --> The Longest Yard <-- Rob Schneider --> Big Stan <-- Jennifer Morrison
166+ // Chris Rock --> Down to Earth <-- John Cho --> Star Trek <-- Jennifer Morrison
167+ ```
168+
169+ You can still declare collections manually, in which case they are added as
170+ data sources in addition to automatically deduced collections.
171+
120172## Examples
121173
122174Load an example graph to get a named graph that reflects some possible
0 commit comments