Graph traversal is a search technique used to visit and explore all the nodes of a graph systematically. The primary goal of graph traversal is to uncover and examine the structure and connections of the graph. There are two common strategies for graph traversal:
The Breadth-First Search (BFS) algorithm explores a graph layer by layer and follows these steps:
Below is an example of traversing the graph using the BFS approach, starting from node A and assuming to visit neighbors in alphabetical order (A~Z):

algo(traverse)Name | Type | Spec | Default | Optional | Description |
|---|---|---|---|---|---|
| ids / uuids | _id / _uuid | / | / | No | ID/UUID of the start node to traverse the graph |
| direction | string | in, out | / | Yes | Direction of edges when traversing the graph |
| traverse_type | string | bfs | bfs | Yes | To traverse the graph in the BFS approach, keep it as bfs |

Spec | Content | Description |
|---|---|---|
| filename | _id,_id | The visited node (toNode), and the node from which it is visited (fromNode) |
UQLalgo(traverse).params({ ids: ['A'], direction: 'out', traverse_type: 'bfs' }).write({ file: { filename: 'result' } })
Results: File result
FileF,E E,B D,A C,F B,A A,A