@ -6,14 +6,14 @@ Cozo is an experimental, relational database that has a focus on graph data, wit
We have stored in our database a relation containing air travel routes. The following query uses joins to find airports reachable by one stop from Frankfurt Airport (FRA), the busiest airport in the world:
We have stored in our database a relation containing air travel routes. The following query uses joins to find airports reachable by one stop from Frankfurt Airport (FRA), the busiest airport in the world:
```
```python
?[destination] := :route{src: 'FRA', dst: stop},
?[destination] := :route{src: 'FRA', dst: stop},
:route{src: stop, dst: destination}
:route{src: stop, dst: destination}
```
```
Using recursion and inline rules, we can find _all_ airports reachable from Frankfurt:
Using recursion and inline rules, we can find _all_ airports reachable from Frankfurt (the transitive closure):
The above computation is asymptotically optimal. For common operations on graphs like the shortest path, using built-in stock algorithms is both simpler and can further boost performance:
The above computation is asymptotically optimal. For common operations on graphs like the shortest path, using built-in stock algorithms is both simpler and can further boost performance: