1
0
Fork 0

Mention that neighbors() and shortest_path() may return null-items.

This commit is contained in:
Wilfried Goesgens 2015-11-10 15:29:42 +01:00
parent c97c27ce87
commit db029a352f
1 changed files with 292 additions and 273 deletions

View File

@ -8,7 +8,9 @@ instead.
!SECTION Determining direct connections
- *EDGES(edgecollection, startvertex, direction, edgeexamples, options)*:
!SUBSECTION Edges
*EDGES(edgecollection, startvertex, direction, edgeexamples, options)*:
Return all edges connected to the vertex *startvertex* as an array. The possible values for
*direction* are:
- *outbound*: Return all outbound edges
@ -35,7 +37,9 @@ instead.
EDGES(friendrelations, "friends/john", "any", null, {includeVertices: true})
- *NEIGHBORS(vertexcollection, edgecollection, startvertex, direction, edgeexamples, options)*:
!SUBSECTION Neighbors
*NEIGHBORS(vertexcollection, edgecollection, startvertex, direction, edgeexamples, options)*:
Returns `_id` values of all distinct neighbors that are directly connected to the
vertex *startvertex* as an array.
@ -70,7 +74,8 @@ instead.
!SECTION General-purpose traversals
- *TRAVERSAL(vertexcollection, edgecollection, startVertex, direction, options)*:
!SUBSECTION Traversal
*TRAVERSAL(vertexcollection, edgecollection, startVertex, direction, options)*:
Traverses the graph described by *vertexcollection* and *edgecollection*,
starting at the vertex identified by id *startVertex*. Vertex connectivity is
specified by the *direction* parameter:
@ -317,8 +322,8 @@ instead.
data: { attributes: [ "_id", "_key", "name" ] }
})
- *TRAVERSAL_TREE(vertexcollection, edgecollection, startVertex, direction, connectName, options)*:
!SUBSECTION Traversal Tree
*TRAVERSAL_TREE(vertexcollection, edgecollection, startVertex, direction, connectName, options)*:
Traverses the graph described by *vertexcollection* and *edgecollection*,
starting at the vertex identified by id *startVertex* and creates a hierarchical result.
Vertex connectivity is establish by inserted an attribute which has the name specified via
@ -335,8 +340,8 @@ instead.
itemOrder: "forward"
})
- *SHORTEST_PATH(vertexcollection, edgecollection, startVertex, endVertex, direction, options)*:
!SUBSECTION Shortest Path
*SHORTEST_PATH(vertexcollection, edgecollection, startVertex, endVertex, direction, options)*:
Determines the first shortest path from the *startVertex* to the *endVertex*.
Both vertices must be present in the vertex collection specified in *vertexcollection*,
and any connecting edges must be present in the collection specified by *edgecollection*.
@ -474,10 +479,10 @@ instead.
return (edge.underConstruction === false); // don't follow these edges
}, false);
!SECTION Other functions
- *PATHS(vertexcollection, edgecollection, direction, options)*:
!SUBSECTION Paths
*PATHS(vertexcollection, edgecollection, direction, options)*:
returns an array of paths through the graph defined by the nodes in the collection
*vertexcollection* and edges in the collection *edgecollection*. For each vertex
in *vertexcollection*, it will determine the paths through the graph depending on the
@ -507,6 +512,18 @@ instead.
FILTER p.source._id == "users/123456"
RETURN p.vertices[*].name
!SECTION Graph consistency
When [using the graph management functions to remove vertices](../GeneralGraphs/Management.md#remove-a-vertex)
you have the guaranty that all referencing edges are also removed.
However, if you use document features alone to remove vertices, no edge collections will be adjusted.
This results in an edge with its `_from` or `_to` attribute referring to vanished vertices.
Now we query such a graph using the [neighbors](#neighbors) or the [shortest path](#shortest-path) functions.
If *includeData* wasn't enabled, the referred missing vertex will not be queried, and thus the result
set will contain the referral to this missing vertex.
If *includeData* is enabled, these missing vertices will be touched by the query.
In order to keep the result set consistent between *includeData* enabled or disabled, a `null` will be padded to fill the gap for each missing vertex.
!SECTION Performance notes
@ -525,3 +542,5 @@ process is specified by the optional *maxIterations* configuration value. If the
vertices processed in a traversal reaches this cap will, the traversal will abort and throw
a *too many iterations* exception.