Metadata-Version: 2.4
Name: fastgx
Version: 2.1.1
Summary: High-performance in-memory graph database
Home-page: https://github.com/cognition-brahmai/fastgraph
Author: BRAHMAI
Author-email: hello@brahmai.in
Maintainer: BRAHMAI
Maintainer-email: hello@brahmai.in
Project-URL: Source, https://github.com/cognition-brahmai/fastgraph
Project-URL: Tracker, https://github.com/cognition-brahmai/fastgraph/issues
Keywords: graph,database,graph-database,in-memory,high-performance,network-analysis,graph-algorithms
Classifier: Development Status :: 5 - Production/Stable
Classifier: Intended Audience :: Developers
Classifier: Intended Audience :: Science/Research
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Topic :: Database
Classifier: Topic :: Scientific/Engineering
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Requires-Python: >=3.8
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: msgpack>=1.0.0
Requires-Dist: click>=8.0.0
Requires-Dist: pyyaml>=6.0
Requires-Dist: typing-extensions>=4.0.0
Provides-Extra: dev
Requires-Dist: pytest>=7.0.0; extra == "dev"
Requires-Dist: pytest-cov>=4.0.0; extra == "dev"
Requires-Dist: pytest-asyncio>=0.21.0; extra == "dev"
Requires-Dist: pytest-mock>=3.10.0; extra == "dev"
Requires-Dist: pytest-xdist>=3.0.0; extra == "dev"
Requires-Dist: black>=22.0.0; extra == "dev"
Requires-Dist: flake8>=5.0.0; extra == "dev"
Requires-Dist: isort>=5.0.0; extra == "dev"
Requires-Dist: pre-commit>=2.20.0; extra == "dev"
Requires-Dist: mypy>=1.0.0; extra == "dev"
Requires-Dist: types-PyYAML>=6.0.0; extra == "dev"
Requires-Dist: types-setuptools>=67.0.0; extra == "dev"
Requires-Dist: sphinx>=5.0.0; extra == "dev"
Requires-Dist: sphinx-rtd-theme>=1.0.0; extra == "dev"
Requires-Dist: myst-parser>=0.18.0; extra == "dev"
Requires-Dist: sphinx-autodoc-typehints>=1.21.0; extra == "dev"
Requires-Dist: psutil>=5.9.0; extra == "dev"
Requires-Dist: memory-profiler>=0.60.0; extra == "dev"
Requires-Dist: line-profiler>=4.0.0; extra == "dev"
Requires-Dist: bandit>=1.7.0; extra == "dev"
Requires-Dist: safety>=2.3.0; extra == "dev"
Requires-Dist: build>=0.8.0; extra == "dev"
Requires-Dist: twine>=4.0.0; extra == "dev"
Requires-Dist: wheel>=0.38.0; extra == "dev"
Provides-Extra: docs
Requires-Dist: sphinx>=5.0.0; extra == "docs"
Requires-Dist: sphinx-rtd-theme>=1.0.0; extra == "docs"
Requires-Dist: myst-parser>=0.18.0; extra == "docs"
Provides-Extra: performance
Requires-Dist: psutil>=5.9.0; extra == "performance"
Requires-Dist: memory-profiler>=0.60.0; extra == "performance"
Provides-Extra: all
Requires-Dist: pytest>=7.0.0; extra == "all"
Requires-Dist: pytest-cov>=4.0.0; extra == "all"
Requires-Dist: pytest-asyncio>=0.21.0; extra == "all"
Requires-Dist: pytest-mock>=3.10.0; extra == "all"
Requires-Dist: pytest-xdist>=3.0.0; extra == "all"
Requires-Dist: black>=22.0.0; extra == "all"
Requires-Dist: flake8>=5.0.0; extra == "all"
Requires-Dist: isort>=5.0.0; extra == "all"
Requires-Dist: pre-commit>=2.20.0; extra == "all"
Requires-Dist: mypy>=1.0.0; extra == "all"
Requires-Dist: types-PyYAML>=6.0.0; extra == "all"
Requires-Dist: types-setuptools>=67.0.0; extra == "all"
Requires-Dist: sphinx>=5.0.0; extra == "all"
Requires-Dist: sphinx-rtd-theme>=1.0.0; extra == "all"
Requires-Dist: myst-parser>=0.18.0; extra == "all"
Requires-Dist: sphinx-autodoc-typehints>=1.21.0; extra == "all"
Requires-Dist: psutil>=5.9.0; extra == "all"
Requires-Dist: memory-profiler>=0.60.0; extra == "all"
Requires-Dist: line-profiler>=4.0.0; extra == "all"
Requires-Dist: bandit>=1.7.0; extra == "all"
Requires-Dist: safety>=2.3.0; extra == "all"
Requires-Dist: build>=0.8.0; extra == "all"
Requires-Dist: twine>=4.0.0; extra == "all"
Requires-Dist: wheel>=0.38.0; extra == "all"
Requires-Dist: sphinx>=5.0.0; extra == "all"
Requires-Dist: sphinx-rtd-theme>=1.0.0; extra == "all"
Requires-Dist: myst-parser>=0.18.0; extra == "all"
Requires-Dist: psutil>=5.9.0; extra == "all"
Requires-Dist: memory-profiler>=0.60.0; extra == "all"
Dynamic: author
Dynamic: author-email
Dynamic: classifier
Dynamic: description
Dynamic: description-content-type
Dynamic: home-page
Dynamic: keywords
Dynamic: license-file
Dynamic: maintainer
Dynamic: maintainer-email
Dynamic: project-url
Dynamic: provides-extra
Dynamic: requires-dist
Dynamic: requires-python
Dynamic: summary

# FastGraph

### *The graph database you build when every other graph database pisses you off.*

[![Python Version](https://img.shields.io/badge/python-3.8+-blue.svg)](https://python.org)
[![License](https://img.shields.io/badge/license-MIT-green.svg)](LICENSE)
[![PyPI Version](https://img.shields.io/badge/pypi-fastgx-orange.svg)](https://pypi.org/project/fastgx/)

<p align="center">
  <img src="https://raw.githubusercontent.com/cognition-brahmai/fastgraph/refs/heads/main/4f0acacd709795a384cf33419ef44346.jpg" width="700"/>
</p>

<br>

FastGraph is the **no-BS, in-memory, lightning-fast graph engine** built for developers who are done tolerating slow, bloated, overengineered graph databases.

This bad boy was born out of pure founder rage and engineered with a single, loud, unapologetic goal:

> **Make graph operations insanely fast and stupidly easy.**

Built by **BRAHMAI**, powered by caffeine, spite, and questionable sleep cycles.

---

# Why FastGraph Exists

Because Neo4j said:

> “Here’s one free database. Pay for the second, peasant.”

Because TigerGraph said:

> “Install our entire planet first.”

And because NetworkX said:

> “Bro I’m a toy, please stop putting me in production.”

So we said:

> **“Nah dude… f**k that. We’ll build our own.”**

And we did.

FastGraph is:

* **In-memory**
* **Blazing fast**
* **Thread-safe**
* **Zero setup**
* **Python-first**
* **Actually fun to use**

You know… the way a modern graph DB *should* feel.

---

# Headline Features (aka: Why This Slaps)

### **O(1) Edge Lookups**

If you know what you want, FastGraph gives it to you instantly.
No traversal. No dancing. No Cypher yoga.

### **Smart API v2.0**

Resource management, path resolution, auto-save, auto-load…
Basically the “don’t make me think” edition.

### **Zero-Copy Subgraph Views**

Slice your graph into meaningful pieces without duplicating a single byte.

### **Smart Persistence**

Files? Formats? Paths?
FastGraph handles it like your personal assistant.

### **Thread Safety**

Hit it with multiple threads. It doesn’t flinch.

### **Auto Indexing**

Runs fast by default. Runs *stupid* fast when it learns your query patterns.

### **Batch Ops & Optimized Algorithms**

Because if you’re loading millions of nodes one-by-one, you hate yourself.

---

# Quick Start

### *The “I got 10 seconds” version*

```python
from fastgraph import FastGraph

with FastGraph("my_graph") as graph:
    graph.add_node("alice", name="Alice", type="Person")
    graph.add_node("bob", name="Bob", type="Person")
    graph.add_edge("alice", "bob", "friends", since=2022)
    # Auto-save on exit. No tears. No drama.
```

---

# Traditional API (still sexy)

```python
from fastgraph import FastGraph

graph = FastGraph("my_graph")

graph.add_node("alice", name="Alice", age=30)
graph.add_node("bob", name="Bob", age=25)
graph.add_edge("alice", "bob", "friends")

print(graph.find_nodes(age__gte=25))
print(graph.neighbors_out("alice", rel="friends"))

graph.save("my_graph.msgpack")
```

---

# What’s New in v2.0 (TLDR: Everything Got Better)

* Zero config mode
* Auto file discovery
* Automatic format detection
* Factory constructors
* Streaming format conversion
* Context-manager resource safety
* Backup & restore
* Enhanced error handling
* Smarter defaults everywhere

Basically v2.0 is the "we cleaned up your mess for you" release.

---

# Smart Persistence That Just Works

```python
graph = FastGraph("social_graph")

if graph.exists():
    graph.load()  # Finds the file like magic
else:
    graph.save()  # Writes to the right place like it knew all along
```

Format conversion?

```python
graph.translate("data.json", "data.msgpack")
```

Straight-up wizardry.

---

# Factory Constructors (AKA: Less Code, More Power)

```python
graph = FastGraph.from_file("existing.msgpack")
graph = FastGraph.load_graph("production_graph")
graph = FastGraph.with_config({"enhanced_api": True}, "test_graph")
```

---

# Subgraph Views (Zero Copy)

```python
people = graph.create_subgraph_view(
    "people",
    lambda id, attrs: attrs.get("type") == "Person"
)

print(people.node_count)
```

No copying. No overhead. No patience required.

---

# Traversal Ops

```python
path = graph.traversal_ops.shortest_path("alice", "bob")
bfs = graph.traversal_ops.bfs("alice", max_depth=3)

for p in graph.traversal_ops.find_paths("alice", "bob"):
    print(p)
```

Your graph. Your rules.

---

# Performance Monitoring (for the nerds)

```python
from fastgraph.utils.performance import performance_monitor

@performance_monitor("query")
def run():
    return graph.find_nodes(type="Person")

print(graph.get_performance_monitor().get_stats())
```

Because real devs measure their flexes.

---

# CLI That Doesn’t Annoy You

```bash
fastgraph create --name social
fastgraph import data.json --format json
fastgraph export social.msgpack --format json --output out.json
fastgraph stats social.msgpack --detailed
fastgraph config --show
```

Neo4j cries reading this simplicity.

---

# Benchmarks (a taste)

| Operation        | Complexity |
| ---------------- | ---------- |
| Node lookup      | O(1)       |
| Edge lookup      | O(1)       |
| Neighbor scan    | O(degree)  |
| Indexed query    | O(log n)   |
| Batch operations | O(n)       |

This thing is FAST, bro.
You’ll feel it.

---

# Contributing

Fork it. Clone it. Break it. Improve it. PR it.
We don’t gatekeep.

---

# Credits

Made by **BRAHMAI**.
Fueled by caffeine, frustration, and the existential need for a graph engine that doesn’t suck.

---

# Final Words

FastGraph isn’t trying to compete with legacy databases.

FastGraph is the **"shut up and give me speed"** graph engine for:

* Agents
* LLMs
* Memory systems
* Recommenders
* Knowledge graphs
* Your unhinged 3 AM ideas

If your app deserves fast relationships, FastGraph deserves to be in it.
