{"id":41655973,"url":"https://github.com/samyama-ai/samyama-graph","last_synced_at":"2026-03-16T08:08:07.455Z","repository":{"id":333981650,"uuid":"1137421559","full_name":"samyama-ai/samyama-graph","owner":"samyama-ai","description":"Samyama Graph Database - A distributed graph database in Rust","archived":false,"fork":false,"pushed_at":"2026-02-16T02:32:01.000Z","size":1176,"stargazers_count":1,"open_issues_count":1,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-02-16T06:07:23.624Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/samyama-ai.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":"CODEOWNERS","security":null,"support":null,"governance":null,"roadmap":"ROADMAP.md","authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2026-01-19T10:51:28.000Z","updated_at":"2026-02-16T02:31:45.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/samyama-ai/samyama-graph","commit_stats":null,"previous_names":["samyama-ai/samyama-graph"],"tags_count":18,"template":false,"template_full_name":null,"purl":"pkg:github/samyama-ai/samyama-graph","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/samyama-ai%2Fsamyama-graph","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/samyama-ai%2Fsamyama-graph/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/samyama-ai%2Fsamyama-graph/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/samyama-ai%2Fsamyama-graph/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/samyama-ai","download_url":"https://codeload.github.com/samyama-ai/samyama-graph/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/samyama-ai%2Fsamyama-graph/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29677044,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-21T06:23:40.028Z","status":"ssl_error","status_checked_at":"2026-02-21T06:23:39.222Z","response_time":107,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2026-01-24T16:27:27.962Z","updated_at":"2026-03-14T06:20:39.057Z","avatar_url":"https://github.com/samyama-ai.png","language":"Rust","funding_links":[],"categories":["Query engines","Applications"],"sub_categories":["Database"],"readme":"# Samyama Graph Database\n\n![Version](https://img.shields.io/badge/version-0.6.1-blue)\n![Rust](https://img.shields.io/badge/rust-1.85-orange)\n![Tests](https://img.shields.io/badge/tests-1842_passing-brightgreen)\n![Coverage](https://img.shields.io/badge/coverage-89.7%25-brightgreen)\n![Bugs](https://img.shields.io/badge/bugs-0-brightgreen)\n![Vulnerabilities](https://img.shields.io/badge/vulnerabilities-0-brightgreen)\n![Quality Gate](https://img.shields.io/badge/quality_gate-passed-brightgreen)\n![Maintainability](https://img.shields.io/badge/maintainability-A-brightgreen)\n![LOC](https://img.shields.io/badge/LOC-44K-informational)\n![License](https://img.shields.io/badge/license-Apache_2.0-blue)\n\n**Samyama** is a high-performance, distributed, AI-native graph database written in **Rust**. It combines a **property graph engine**, **vector search**, **graph analytics**, and **natural language querying** in a single binary.\n\n### LDBC Benchmark Results (v0.6.0, Mac Mini M4)\n\n| Benchmark | Queries | Pass Rate | Dataset |\n|-----------|---------|-----------|---------|\n| **SNB Interactive** | 21 reads | **21/21 (100%)** | SF1: 3.18M nodes, 17.26M edges |\n| **SNB Business Intelligence** | 20 analytical | **16/16 run (100%)** (BI-17+ timeout) | SF1 (same dataset) |\n| **Graphalytics** | 6 algorithms x 2 datasets | **12/12 (100%)** | LDBC XS reference graphs |\n| **FinBench** | 12 CR + 6 SR + 3 RW + 19 W | **40/40 (100%)** | Synthetic: 7.7K nodes, 42.2K edges |\n\nSee [docs/ldbc/](docs/ldbc/) for detailed per-query results, latency tables, and analysis.\n\n### What's New in v0.6.1\n\n- **HTTP Tenant Management API**: Full CRUD for tenants via REST endpoints (`POST /api/tenants`, `GET /api/tenants`, `GET /api/tenants/{id}`, `DELETE /api/tenants/{id}`).\n- **samyama-mcp-serve**: Auto-generate [MCP (Model Context Protocol)](https://modelcontextprotocol.io/) servers from any graph schema. Discovers labels, edge types, and properties, then generates typed tools for AI agents. Install via `pip install samyama[mcp]` and run `samyama-mcp-serve --demo` for instant agent tool access.\n- **Snapshot format (.sgsnap)**: Portable gzip JSON-lines snapshot export/import for graph tenants, enabling backup and migration across instances.\n- **Cricket dataset loader**: Load 21K Cricsheet T20/ODI/Test matches (36K nodes, 1.4M edges) via `cargo run --release --example cricket_loader`.\n- **AACT clinical trials loader**: Full AACT dataset loader for clinical trial analysis (575K studies, 7.7M nodes, 27M edges).\n- **Index scan fix**: Inline MATCH properties `{prop: val}` now trigger IndexScan when a matching index exists, avoiding full label scans.\n\n## Key Features\n\n- **OpenCypher Query Engine**: ~90% OpenCypher coverage — MATCH, CREATE, DELETE, SET, MERGE, OPTIONAL MATCH, UNION, WITH, UNWIND, aggregations, and 30+ built-in functions.\n- **RESP Protocol**: Drop-in compatibility with any Redis client (`redis-cli`, Jedis, ioredis).\n- **Vector Search**: Built-in HNSW indexing for millisecond semantic search and Graph RAG.\n- **NLQ (Natural Language Queries)**: Ask questions in plain English — the LLM translates to Cypher automatically.\n- **Graph Algorithms**: Native PageRank, BFS, Dijkstra, WCC, SCC, CDLP, LCC, MaxFlow, MST, SSSP, Triangle Counting.\n- **Optimization Solvers**: 15+ metaheuristic algorithms (Jaya, Rao, GWO, PSO, Firefly, Cuckoo, ABC, NSGA-II) for in-database optimization.\n- **Multi-Tenancy**: Tenant-level isolation with per-tenant quotas via RocksDB column families.\n- **High Availability**: Raft consensus (via `openraft`) for cluster replication and automatic failover.\n- **Persistence**: RocksDB storage with Write-Ahead Log and checkpointing.\n- **EXPLAIN Queries**: Inspect query execution plans without running them.\n- **HTTP Tenant API**: REST endpoints for tenant CRUD (create, list, get, delete) alongside the RESP protocol.\n- **MCP Server Generation**: Auto-generate MCP servers from graph schema for AI agent integration (`samyama-mcp-serve`).\n- **Snapshot Export/Import**: Portable `.sgsnap` format (gzip JSON-lines) for tenant backup and migration.\n\n## Getting Started\n\n### Build\n\n```bash\ngit clone https://github.com/samyama-ai/samyama-graph\ncd samyama-graph\ncargo build --release\n```\n\n### Run the Server\n\n```bash\n./target/release/samyama\n```\n\nThis starts the RESP server on port 6379 and the HTTP API on port 8080.\n\n### Connect\n\n```bash\nredis-cli -p 6379\n\n# Create nodes\nGRAPH.QUERY mygraph \"CREATE (n:Person {name: 'Alice', age: 30})\"\n\n# Query\nGRAPH.QUERY mygraph \"MATCH (n:Person) RETURN n\"\n\n# Explain a query plan\nGRAPH.QUERY mygraph \"EXPLAIN MATCH (n:Person) WHERE n.age \u003e 25 RETURN n\"\n```\n\n## Examples\n\nSamyama ships with domain-specific demos that showcase the full feature set.\n\n### Core Infrastructure\n\n| Example | Command | Description |\n|---------|---------|-------------|\n| Persistence | `cargo run --example persistence_demo` | RocksDB persistence, WAL, multi-tenancy, recovery |\n| Cluster | `cargo run --example cluster_demo` | 3-node Raft cluster with leader election and failover |\n| Full Benchmark | `cargo run --example full_benchmark` | Scale test up to 1M+ nodes |\n\n### Industry Demos (with NLQ + Agentic Enrichment)\n\nEach demo builds a domain-specific knowledge graph, runs Cypher queries, executes graph algorithms, and demonstrates natural language querying via the NLQ pipeline.\n\n| Example | Command | What it demonstrates |\n|---------|---------|---------------------|\n| Banking / Fraud Detection | `cargo run --example banking_demo` | Customer segmentation, fraud patterns, money laundering detection, OFAC screening |\n| Clinical Trials | `cargo run --example clinical_trials_demo` | Patient-trial matching (vector search), drug interactions (PageRank), site optimization (NSGA-II) |\n| Supply Chain | `cargo run --example supply_chain_demo` | Disruption analysis, cold-chain monitoring, port optimization (Jaya), alternative suppliers (vector search) |\n| Smart Manufacturing | `cargo run --example smart_manufacturing_demo` | Digital twin, failure cascade analysis, production scheduling (Cuckoo Search), energy optimization |\n| Social Network | `cargo run --example social_network_demo` | Follower graphs, mutual connections, influence analysis (PageRank), community detection (WCC) |\n| Knowledge Graph | `cargo run --example knowledge_graph_demo` | Document lineage, expert finding (vector search), topic clustering, knowledge hub identification |\n| Enterprise SOC | `cargo run --example enterprise_soc_demo` | Threat intel, MITRE ATT\u0026CK mapping, attack path analysis (Dijkstra), lateral movement simulation |\n| Agentic Enrichment | `cargo run --example agentic_enrichment_demo` | Generation-Augmented Knowledge (GAK) — LLM generates Cypher to enrich the graph autonomously |\n\n### Data Loaders\n\n| Example | Command | Description |\n|---------|---------|-------------|\n| LDBC SNB | `cargo run --example ldbc_loader` | Load LDBC SNB SF1 dataset (3.18M nodes, 17.26M edges) |\n| FinBench | `cargo run --example finbench_loader` | Load/generate LDBC FinBench dataset |\n| Cricket | `cargo run --release --example cricket_loader` | Load 21K Cricsheet matches (36K nodes, 1.4M edges) |\n| AACT Clinical Trials | `cargo run --release --example aact_loader` | Full AACT dataset (575K studies, 7.7M nodes, 27M edges) |\n\n### AI Agent Integration\n\n| Example | Command | Description |\n|---------|---------|-------------|\n| MCP Server | `samyama-mcp-serve --demo` | Auto-generate MCP server from graph schema for AI agents (Python, `pip install samyama[mcp]`) |\n\n## Cypher Support\n\n**~90% OpenCypher coverage.** See [docs/CYPHER_COMPATIBILITY.md](docs/CYPHER_COMPATIBILITY.md) for the full matrix.\n\n### Supported Clauses\n\n`MATCH`, `OPTIONAL MATCH`, `WHERE`, `RETURN`, `RETURN DISTINCT`, `ORDER BY`, `SKIP`, `LIMIT`, `CREATE`, `DELETE`, `DETACH DELETE`, `SET`, `REMOVE`, `MERGE` (with `ON CREATE SET` / `ON MATCH SET`), `WITH`, `UNWIND`, `UNION` / `UNION ALL`, `EXPLAIN`, `EXISTS` subqueries\n\n### Supported Functions\n\n| Category | Functions |\n|----------|-----------|\n| String | `toUpper`, `toLower`, `trim`, `replace`, `substring`, `left`, `right`, `reverse`, `toString` |\n| Numeric | `abs`, `ceil`, `floor`, `round`, `sqrt`, `sign`, `toInteger`, `toFloat` |\n| Aggregation | `count`, `sum`, `avg`, `min`, `max`, `collect` |\n| List/Collection | `size`, `length`, `head`, `last`, `tail`, `keys`, `range` |\n| Graph | `id`, `labels`, `type`, `exists`, `coalesce`, `startsWith`, `endsWith`, `contains` |\n\n### Operators\n\nArithmetic (`+`, `-`, `*`, `/`, `%`), comparison (`=`, `\u003c\u003e`, `\u003c`, `\u003e`, `\u003c=`, `\u003e=`), logical (`AND`, `OR`, `NOT`, `XOR`), string (`STARTS WITH`, `ENDS WITH`, `CONTAINS`, `=~`), null (`IS NULL`, `IS NOT NULL`), list (`IN`).\n\nCross-type coercion: Integer/Float promotion and String/Boolean coercion for LLM-generated queries. Null propagation follows Neo4j three-valued logic.\n\n## Architecture\n\n```\nsrc/\n├── graph/           # Property graph model (Node, Edge, PropertyValue, GraphStore)\n├── query/           # OpenCypher engine\n│   ├── cypher.pest  #   PEG grammar (Pest)\n│   ├── parser.rs    #   Parser → AST\n│   └── executor/    #   Volcano iterator model (scan, filter, expand, project, aggregate, sort, limit)\n├── protocol/        # RESP3 server (Tokio TCP)\n├── persistence/     # RocksDB + WAL + multi-tenancy\n├── raft/            # Raft consensus (openraft)\n├── nlq/             # Natural Language Query pipeline (OpenAI, Gemini, Ollama, Claude Code)\n├── vector/          # HNSW vector index\n├── snapshot/        # Portable .sgsnap export/import\n└── sharding/        # Tenant-level sharding\n```\n\nKey design decisions are documented as [Architecture Decision Records](docs/ADR/).\n\n## Companion Crates\n\n- **[samyama-graph-algorithms](crates/samyama-graph-algorithms/)**: PageRank, BFS, Dijkstra, WCC, SCC, MaxFlow, MST, Triangle Counting\n- **[samyama-optimization](crates/samyama-optimization/)**: 15+ metaheuristic solvers for single and multi-objective optimization\n\n## Benchmarks\n\nRun with `cargo bench`. See [docs/performance/](docs/performance/) for detailed results.\n\n| Operation | Throughput | Notes |\n|-----------|-----------|-------|\n| Node insertion | ~3.4M nodes/sec | At 1K batch, single-threaded |\n| Label scan | \u003c1 us | 100-node label groups |\n| 1-hop traversal | ~22 us | MATCH-WHERE-RETURN pattern |\n| Cypher parse | \u003c8 us | Multi-hop patterns with aggregation |\n\n## Documentation\n\n- [LDBC Benchmark Results](docs/ldbc/) — SNB Interactive, SNB BI, Graphalytics, FinBench\n- [Architecture](docs/ARCHITECTURE.md)\n- [Cypher Compatibility](docs/CYPHER_COMPATIBILITY.md)\n- [ACID Guarantees](docs/ACID_GUARANTEES.md)\n- [Benchmarks](docs/performance/BENCHMARKS.md)\n- [Architecture Decision Records](docs/ADR/)\n- [Technology Comparisons](docs/TECHNOLOGY_COMPARISONS.md)\n\n## Testing\n\n1842 unit tests, integration tests via Python scripts, and 8 domain-specific example demos.\n\n```bash\ncargo test                     # Run all tests\ncargo bench                    # Run benchmarks\ncargo clippy -- -D warnings    # Lint\ncargo fmt -- --check           # Format check\n```\n\n## License\n\nApache License 2.0\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsamyama-ai%2Fsamyama-graph","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsamyama-ai%2Fsamyama-graph","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsamyama-ai%2Fsamyama-graph/lists"}