Home / Companies / SurrealDB / Blog / Post Details
Content Deep Dive

Multi-hop graph traversal inside SurrealDB

Blog post from SurrealDB

Post Details
Company
Date Published
Author
Martin Schaer
Word Count
3,142
Company Posts That Month
5
Language
English
Hacker News Points
-
Post removed?
No
Summary

A SurrealDB 3.x tutorial demonstrates how moving multi-hop graph traversal from application-side breadth-first-search loops into the database can reduce network round trips, transferred data, and latency while enabling filtering during each hop. Using a synthetic GraphRAG dataset of 2,000 entities, 16,000 typed edges, and 800 documents, it shows that unpruned three-hop walks can rapidly expand to hundreds of reachable nodes, making cardinality management more important than individual-hop performance. The recommended approach uses recursive SurrealQL traversal with per-edge filters for relation types and confidence, per-node filters for tenant and visibility constraints, depth ranges, and de-duplicated collection of reachable entities; path output can also provide explanations for why results were retrieved. The tutorial discusses safeguards for dense hubs, noting that per-hop edge slicing bounds expansion but may discard valid routes and can return no results when too few edges exist. It further combines graph traversal with reverse document-mention hops for ranked document retrieval and HNSW vector search for hybrid retrieval, while explaining that normal indexes benefit graph entry points but arrow-based traversal uses direct graph-edge scans rather than secondary edge-table indexes. Benchmark results cited show equivalent 14-entity outputs with server-side traversal requiring one round trip and 241 bytes versus six round trips and about 4,905 bytes for application-side BFS, and the tutorial concludes that pruning at every hop, measuring frontier size, and limiting traversal depth are central practices for scalable graph retrieval.

Trends Found in this Post
Trend Post Mentions Total Month Mentions Posts Companies MoM
Vector Search 8 265 57 33 -89%
AI Agents 1 931 231 103 -84%
LLM 1 747 162 79 -85%
Use This Data

Use this post, company, and trend context to find content marketing opportunities, perform competitive analysis, or address product feature gaps via the Plushcap MCP server or the Plushcap API.