Skip to main content

High-performance in-memory graph database

Project description

FastGraph

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

Python Version License PyPI Version


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… fk 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

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)

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

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?

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

Straight-up wizardry.


Factory Constructors (AKA: Less Code, More Power)

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)

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

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)

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

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.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

fastgx-2.1.2.tar.gz (142.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

fastgx-2.1.2-py3-none-any.whl (77.1 kB view details)

Uploaded Python 3

File details

Details for the file fastgx-2.1.2.tar.gz.

File metadata

  • Download URL: fastgx-2.1.2.tar.gz
  • Upload date:
  • Size: 142.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.9

File hashes

Hashes for fastgx-2.1.2.tar.gz
Algorithm Hash digest
SHA256 d0c4032a09adc6f581828332ccc07a421126e531f7d0fbbc3daa5d6373437012
MD5 59624ce140db12fd6e73808923e9f37e
BLAKE2b-256 d61e98bec920438459d0cc0aaef04fe33cc9cdf3fa47fbcf21f4509f66f29902

See more details on using hashes here.

File details

Details for the file fastgx-2.1.2-py3-none-any.whl.

File metadata

  • Download URL: fastgx-2.1.2-py3-none-any.whl
  • Upload date:
  • Size: 77.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.9

File hashes

Hashes for fastgx-2.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 da869e9da24df282f93f88f4b54e9fefa4c435c38d8620f8bf7c2cd669ce0b73
MD5 b0e5343e6edc6ddb8834ef7dba7b2e28
BLAKE2b-256 489fe73de18bb1f8dac9da8deb9bcd114ba4ceda921dcf8366f0e2222a014ebb

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page