Skip to main content

sqlitegraph

Python bindings to sqlitegraph — an embedded graph database with 35+ graph algorithms and HNSW vector search. Rust core, no server required, single .db or .graph file.

Install

pip install sqlitegraph

Quick start

from sqlitegraph import Graph

g = Graph.open_in_memory()
alice = g.add_node(kind="User", name="Alice", data={"age": 30})
order = g.add_node(kind="Order", name="Order-123")
g.add_edge(alice, order, "placed")

print(g.neighbors(alice))

Query language

Graph.query() exposes the same Cypher-inspired language as the CLI:

from sqlitegraph import Graph

g = Graph.open_in_memory()
alice = g.add_node(kind="User", name="Alice", data={"age": 30})
bob = g.add_node(kind="User", name="Bob", data={"age": 31})
g.add_edge(alice, bob, "KNOWS")

result = g.query("MATCH (a:User)-[:KNOWS]->(b:User) RETURN a.name, b.name")
print(result["results"])

Supported query features include node scans, edge traversal, multi-hop chains, star/multi-pattern joins, variable-depth edges, WHERE with regex/numeric operators and parentheses, LIMIT, CREATE, SET, DELETE, and HNSW vector search through CALL db.index.vector.queryNodes(...).

Algorithms

from sqlitegraph import Graph

g = Graph.open_in_memory()
a = g.add_node(kind="Page", name="A")
b = g.add_node(kind="Page", name="B")
c = g.add_node(kind="Page", name="C")
g.add_edge(a, b, "LINKS")
g.add_edge(b, c, "LINKS")
g.add_edge(c, a, "LINKS")

print(g.pagerank(iterations=20))
print(g.connected_components())
print(g.strongly_connected_components())
print(g.label_propagation(50))
print(g.find_cycles(10))
print(g.dominators(a))

critical_path() is also available for directed acyclic graphs and returns {"path": [...], "distance": float, "path_length": int}.

HNSW vector search

from sqlitegraph import Graph

g = Graph.open_in_memory()
idx = g.create_hnsw_index("embeddings", dimension=3, metric="cosine")

idx.insert_vector([1.0, 0.8, 0.1], {"label": "graph databases"})
idx.insert_vector([0.1, 0.2, 1.0], {"label": "baking"})

print(idx.search([1.0, 0.9, 0.0], 1))
print(g.list_hnsw_indexes())

g.delete_hnsw_index("embeddings")

Examples

The examples/ directory contains runnable scripts:

Example What it shows
01_basic_crud.py Nodes, edges, update, delete, query by kind/pattern, degrees
02_graph_algorithms.py BFS, k-hop, shortest path, PageRank, Louvain & label-propagation communities, connected components (WCC), strongly-connected components (SCC), cycle search, dominator tree, critical path
03_vector_search.py HNSW index creation, insert, search, bulk insert, index listing
04_social_network.py Realistic network: influencers (PageRank), communities, connection paths, mutual follows
05_file_backed.py Persistent Graph.open(path), checkpoint, reopen, cleanup
06_hybrid_sqlite_hnsw_query.py sqlite3 application rows + sqlitegraph metadata + HNSW + Graph.query() expansion

Run any example from the repo root:

cd sqlitegraph-py
source .venv/bin/activate
python examples/01_basic_crud.py

Metadata

Release files for sqlitegraph 0.5.6

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for sqlitegraph 0.5.6
File Size Uploaded
sqlitegraph-0.5.6.tar.gz 1.2 MB Details

Built distributions (wheels)

Table of built distributions (wheels) for sqlitegraph 0.5.6
File
sqlitegraph-0.5.6-cp310-abi3-win_amd64.whl CPython 3.10 abi3 Windows x86-64 Details
sqlitegraph-0.5.6-cp310-abi3-manylinux_2_28_x86_64.whl CPython 3.10 abi3 Linux glibc 2.28+ x86-64 Details
sqlitegraph-0.5.6-cp310-abi3-manylinux_2_28_aarch64.whl CPython 3.10 abi3 Linux glibc 2.28+ ARM64 Details
sqlitegraph-0.5.6-cp310-abi3-macosx_11_0_arm64.whl CPython 3.10 abi3 macOS 11.0+ ARM64 Details
sqlitegraph-0.5.6-cp310-abi3-macosx_10_12_x86_64.whl CPython 3.10 abi3 macOS 10.12+ x86-64 Details

Total release size: 11.8 MB

Release files / sqlitegraph-0.5.6.tar.gz

Download URL sqlitegraph-0.5.6.tar.gz
Size 1.2 MB
Tags Source
SHA-256 checksum
How to use checksums
0a7d6b424752924d471a8913efabb0143724115bc32ca2644c7763df2ea8bb1d
BLAKE2b-256 checksum
How to use checksums
059a28eba987fe2547ad0f7d3c84645b026f6dffc47ec308acbfa23dad8479f5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jul 11, 2026.

Transparency log

Release files / sqlitegraph-0.5.6-cp310-abi3-win_amd64.whl

Download URL sqlitegraph-0.5.6-cp310-abi3-win_amd64.whl
Size 2.0 MB
Tags CPython 3.10 Windows x86-64 abi3
SHA-256 checksum
How to use checksums
5defa4c5f44060f1d595a9e479e10d673de21f9c0cd8044e58bf51ef4ca22355
BLAKE2b-256 checksum
How to use checksums
7c9dd29b2209a3765f4108a9fbb3ad7577371fca9c88d6a6440927d23a062826
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jul 11, 2026.

Transparency log

Release files / sqlitegraph-0.5.6-cp310-abi3-manylinux_2_28_x86_64.whl

Download URL sqlitegraph-0.5.6-cp310-abi3-manylinux_2_28_x86_64.whl
Size 2.4 MB
Tags CPython 3.10 Linux glibc 2.28+ x86-64 abi3
SHA-256 checksum
How to use checksums
5a8c2f3abe6db8b8a1b30418529eb35b594f94a5e1f40f005092917db7b16774
BLAKE2b-256 checksum
How to use checksums
83541a4146044a677c13b2e7cab0d7464da095c4cfb413c31694d0534dbf7a7e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jul 11, 2026.

Transparency log

Release files / sqlitegraph-0.5.6-cp310-abi3-manylinux_2_28_aarch64.whl

Download URL sqlitegraph-0.5.6-cp310-abi3-manylinux_2_28_aarch64.whl
Size 2.1 MB
Tags CPython 3.10 Linux glibc 2.28+ ARM64 abi3
SHA-256 checksum
How to use checksums
7a3d95b74df7604be85ae8c71f48a11740bb2fc48b91c7119c704c9fa53774e3
BLAKE2b-256 checksum
How to use checksums
f6407c1e2f8934f67efea9534cf3c902f09a35984556a0d9d6645877a3153dab
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jul 11, 2026.

Transparency log

Release files / sqlitegraph-0.5.6-cp310-abi3-macosx_11_0_arm64.whl

Download URL sqlitegraph-0.5.6-cp310-abi3-macosx_11_0_arm64.whl
Size 2.0 MB
Tags CPython 3.10 abi3 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
4c1c173c18ac7e791b150cf4d268a2672b70eac5c41d048ec55815530de5a8b5
BLAKE2b-256 checksum
How to use checksums
bb2b07272c7e0fa12c143ab1a56bf1d798f8a6d4032fa99c4894072e8fd1e194
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jul 11, 2026.

Transparency log

Release files / sqlitegraph-0.5.6-cp310-abi3-macosx_10_12_x86_64.whl

Download URL sqlitegraph-0.5.6-cp310-abi3-macosx_10_12_x86_64.whl
Size 2.2 MB
Tags CPython 3.10 abi3 macOS 10.12+ x86-64
SHA-256 checksum
How to use checksums
d9fd990c756ff2344b2504805046ef6719d7e35430ed19afa612729f825aebc0
BLAKE2b-256 checksum
How to use checksums
0f27df6d7326599712261e972f015e83a34974d1f0f2067464ddf71fdacc81b6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jul 11, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.5.6 This release

6 release files

0.5.3

6 release files

0.5.2

6 release files

0.5.1

6 release files

0.5.0

6 release files

0.4.2

6 release files

0.4.1

6 release files

0.4.0

6 release files

0.3.0

6 release files

0.2.0

6 release files

0.1.1

6 release files

0.1.0

6 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page