ruvector/crates/ruvector-dag/tests/data/sample_dags.json
Claude bc4e63d4d4
feat(dag): implement Neural Self-Learning DAG with QuDAG integration
Complete implementation of the Neural DAG Learning system combining RuVector
vector database with QuDAG quantum-resistant consensus.

Core Features:
- QueryDag structure with HashMap-based adjacency and cycle detection
- 18+ operator types (SeqScan, HnswScan, HashJoin, NestedLoop, etc.)
- Topological, DFS, and BFS traversal iterators
- JSON/binary serialization

Attention Mechanisms (7 total):
- Basic: Topological, CausalCone, CriticalPath, MinCutGated
- Advanced: HierarchicalLorentz, ParallelBranch, TemporalBTSP
- UCB bandit selector for automatic mechanism selection
- LRU attention cache with 10k entry default

SONA (Self-Optimizing Neural Architecture):
- MicroLoRA adaptation (<100μs, rank-2)
- TrajectoryBuffer with lock-free ArrayQueue (10k capacity)
- ReasoningBank with K-means++ clustering
- EWC++ for catastrophic forgetting prevention (λ=5000)

MinCut Optimization:
- O(n^0.12) subpolynomial amortized updates
- Local k-cut approximation for sublinear bottleneck detection
- Criticality-based flow computation
- Redundancy analysis and repair suggestions

Self-Healing System:
- Z-score anomaly detection with adaptive thresholds
- Index health monitoring (HNSW/IVFFlat metrics)
- Learning drift detection with ADWIN algorithm
- Repair strategies: reindex, parameter tuning, learning reset

QuDAG Integration:
- ML-KEM-768 quantum-resistant encryption
- ML-DSA-65 quantum-resistant signatures
- Differential privacy (Laplace/Gaussian mechanisms)
- rUv token staking, rewards (5% APY), governance (67% threshold)

PostgreSQL Extension:
- GUC variables for configuration
- Planner/executor hooks for query interception
- Background worker for continuous learning
- 50+ SQL functions for all features

Testing:
- 46+ integration tests across all modules
- 11 benchmark groups for performance validation
- Test fixtures and data generators
- Mock QuDAG client for isolated testing

Documentation:
- Comprehensive README with architecture overview
- 5 example programs demonstrating all features
- Implementation notes for attention mechanisms

Total: ~12,000+ lines of new Rust code
2025-12-29 22:58:43 +00:00

28 lines
971 B
JSON

{
"simple_scan": {
"nodes": [
{"id": 0, "type": "SeqScan", "table": "users", "cost": 100.0},
{"id": 1, "type": "Filter", "predicate": "id > 0", "cost": 10.0},
{"id": 2, "type": "Result", "cost": 1.0}
],
"edges": [[0, 1], [1, 2]]
},
"vector_search": {
"nodes": [
{"id": 0, "type": "HnswScan", "index": "vec_idx", "ef_search": 64, "cost": 50.0},
{"id": 1, "type": "Limit", "count": 10, "cost": 1.0},
{"id": 2, "type": "Result", "cost": 1.0}
],
"edges": [[0, 1], [1, 2]]
},
"join_query": {
"nodes": [
{"id": 0, "type": "SeqScan", "table": "orders", "cost": 500.0},
{"id": 1, "type": "IndexScan", "index": "products_pkey", "cost": 100.0},
{"id": 2, "type": "HashJoin", "key": "product_id", "cost": 200.0},
{"id": 3, "type": "Sort", "keys": ["created_at"], "cost": 50.0},
{"id": 4, "type": "Result", "cost": 1.0}
],
"edges": [[0, 2], [1, 2], [2, 3], [3, 4]]
}
}