Traversal Steps
Navigate and traverse your graph with powerful query operations
Graph Traversal Fundamentals
Graph traversal is the process of visiting nodes and edges in a graph. Helix QL provides a rich set of operations to navigate your graph data efficiently.
Selection Operations
These operations serve as starting points for your graph traversals.
Node Selection (N
)
Select nodes from your graph to begin traversal.
Syntax | Description |
---|---|
N | Select all nodes in the graph |
N<Type> | Select all nodes of a specific type |
N<Type>("id") | Select a node by its ID |
N<Type>("id1", "id2") | Select nodes of a specific with given IDs and define its type for correctness |
Edge Selection (E
)
Select edges from your graph to begin traversal.
Syntax | Description |
---|---|
E | Select all edges in the graph |
E<Type> | Select all edges of a specific type |
E<Type>("id") | Select an edge by its ID |
E<Type>("id1", "id2") | Select edges of a specific type with given IDs |
Anonymous Traveral (_
)
Continue a traversal without breaking the overall traversal flow. Useful for an inner traversal where you don’t want it to affect the overall traversal.
Traversal Operations
Once you’ve selected your starting points, these operations allow you to navigate through the graph.
Node-to-Node Navigation
Move from nodes to their connected nodes.
Operation | Description |
---|---|
::Out<EdgeType> | Traverse to nodes connected by outgoing edges of specific type |
::In<EdgeType> | Traverse to nodes connected by incoming edges of specific type |
::Both<EdgeType> | Traverse to nodes connected by edges of specific type in either direction |
Node-to-Edge Navigation
Move from nodes to their connected edges.
Operation | Description |
---|---|
::OutE<EdgeType> | Get outgoing edges of specific type |
::InE<EdgeType> | Get incoming edges of specific type |
::BothE<EdgeType> | Get edges of specific type in either direction |
Edge-to-Node Navigation
Move from edges to their connected nodes.
Operation | Description |
---|---|
::OutN | Get source node (where edge starts) |
::InN | Get target node (where edge ends) |
Combining Traversal Steps
Helix QL allows you to chain traversal operations to create complex graph queries.
Was this page helpful?