Overview
The$edge operator is one of the most powerful features in GenosDB. It transforms a standard query into a graph exploration tool, enabling recursive traversal of node relationships to find descendants at any depth.
How It Works
A query with$edge has two logical parts:
- Starting Point Query: The main query finds the node(s) from which traversal begins
- Descendant Filter: The
$edgesub-query filters all descendants in the graph
$edge criteria, not the starting nodes.
Basic Syntax
Examples
Find All Files in a Folder
Multi-Level Traversal
Filter Descendants by Properties
Complex Descendant Filters
Organization Chart - All Employees
Social Network - All Connections
Product Categories
Blog Post with Nested Comments
Find All Descendants (No Filter)
Nested $edge Queries
Task Dependencies
Real-Time Graph Monitoring
Advanced Patterns
Combined with Other Operators
Limiting Traversal Results
Use Cases
File Systems
Navigate folder hierarchies and find files at any depth
Organization Charts
Query employee reporting structures and team hierarchies
Social Graphs
Explore friend networks and social connections
Product Catalogs
Browse nested category structures and products
Task Management
Track task dependencies and subtasks
Knowledge Graphs
Navigate concept relationships and dependencies
Performance Considerations
Efficient Traversal: GenosDB optimizes graph traversal by:
- Indexing edges for fast lookups
- Caching frequently accessed nodes
- Short-circuiting when descendant filters don’t match
Comparison with SQL
In SQL, this type of recursive query requires complex CTEs (Common Table Expressions):Related Operators
- Comparison Operators - Filter descendants
- Logical Operators - Combine filters
- link() - Create edges for traversal