Path Traversal
Fri, 05 Aug 2022 06:29:09 GMT — Properties
Properties
Key | Value |
---|---|
Identifier | path-traversal |
Name | Path Traversal |
Type | Topic |
Creation timestamp | Fri, 05 Aug 2022 06:29:09 GMT |
Modification timestamp | Tue, 09 Aug 2022 06:05:28 GMT |
Tags
lpgGremlin Terminology
Definitions
- Adjacent Vertex: Vertices are adjacent to another vertex if there is an edge connecting them. B, C and D are all adjacent to A. A is the only vertex adjacent to either B, C or D.
- Incident Vertex or Edge: A vertex and edge are considered incident if they are connected to each other. A is incident to E, F and G. B is only incident to E. The edge E is both incident to A and B.
Methods Applied to Vertices
- Vertices
out(label)
: Outgoing adjacent vertices. If applied to A, then B and D.in(label)
: Incoming adjacent vertices. If applied to A, then C.both(label)
: Outgoing and incoming adjacent vertices. If applied to A, then B, C and D.
- Edges
outE(label)
: Outgoing incident edges. If applied to A, then E and G.inE(label)
: Incoming incident edges. If applied to A, then F.bothE(label)
: Outgoing and incoming incident edges. If applied to A, then E, F and G.
Note that the steps can optionally take the name of one or more edge labels as a parameter. If omitted, all relevant edges will be traversed.
Methods Applied to Edges
outV()
: Outgoing vertex. If applied to E, then A.inV()
: Incoming vertex. If applied to E, then B.bothV()
: Both vertices. If applied to E, then A and B.otherV()
: The vertex that was not the vertex we came from. So, if we came from A, then B and vice versa.
The above set of methods are applied to edges to return vertices.
Notes
Tue, 16 Aug 2022 06:24:09 GMT
Shortest-path query
gremlin> g.V().has('name', 'hercules')
==> v[8360]
gremlin> g.V().has('name', 'sea')
==> v[4264]
gremlin> g.V(8360).repeat(out().simplePath()).until(hasId(4264))
.path().limit(1)
==> path[v[8360], v[4328], v[4192], v[4264]]
Topic location
- Map: Knowledge Graphs — Info
- Topic: Path Traversal
- Scope: Universal Active
Topic resources
- Images
- Links