Getting Started

Tutorial: Building with CleaveDB

Direction & Depth

In dense graphs, traversing without constraints can quickly trigger an exponential path explosion. CleaveDB gives you fine-grained control over edge orientation using DIRECTION and maximum traversal distance using DEPTH.

Edge directionality

You can configure the traversal engine to follow edges outward, inward, or symmetrically:

  • DIRECTION OUTGOING: Follows only edges pointing away from the anchor document (default).
  • DIRECTION INCOMING: Follows edges pointing into the anchor document (e.g., find who follows Ana).
  • DIRECTION BOTH: Traverses edges bidirectionally regardless of edge orientation.
CleaveQLExample · Incoming follower query
FOLLOW "users:ana" THROUGH "follows" DIRECTION INCOMING DEPTH 1

This locates all users who have an outgoing "follows" bond pointing into Ana's record.

Setting depth horizons

Cap the number of hops using DEPTH to prevent runaway traversals:

CleaveQLExample · Depth-bounded neighborhood query
FOLLOW "users:ana" THROUGH "collaborates" DIRECTION BOTH DEPTH 2 LIMIT 25

The BFS traversal stops exploring paths that exceed 2 hops, returning up to 25 documents within Ana's immediate two-degree circle.