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.0.tar.gz (140.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.0-py3-none-any.whl (77.1 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: fastgx-2.1.0.tar.gz
  • Upload date:
  • Size: 140.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.0.tar.gz
Algorithm Hash digest
SHA256 24d565c67c627991ff43ab27244b850e432ae78c30210e012c4a6af30973c3b9
MD5 b199bf256a4cd66a50fc31a92b2fba7f
BLAKE2b-256 893017fa1ca98daafaaa8fc2684ae56db93ebb4980cf61d573f565b9be44cef6

See more details on using hashes here.

File details

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

File metadata

  • Download URL: fastgx-2.1.0-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.0-py3-none-any.whl
Algorithm Hash digest
SHA256 13c1fce901b5b28ebf52abdd7910307cc59d5b7b9a16e054dbbe82509127d3d5
MD5 8613e84d6d8a998a129fbf203b624222
BLAKE2b-256 57a49d90e1db71d99a4804f9125ebe99c04a32cff5654bf3ac7211a4c3e54b5b

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