Overview
nx-neptune is a Python library that brings graph analytics to your data lake. Project your data from Amazon S3 Tables, S3 Vectors, Databricks, Snowflake, OpenSearch, and other sources into Neptune Analytics for graph analysis — with results exported back to S3 or persisted as Iceberg tables.
Two interfaces
Section titled “Two interfaces”nx-neptune exposes two distinct interfaces for different use cases:
Graph Over Data Lake (Session Manager)
Section titled “Graph Over Data Lake (Session Manager)”Run graph algorithms on data that lives in your data lake — without moving it permanently into a graph database. The SessionManager API manages the full lifecycle: create, import, analyze, export, and destroy.
Supported data sources:
- Amazon S3 Tables — query Iceberg tables via Athena SQL
- Amazon S3 Vectors — project vector embeddings via a custom Athena connector
- Databricks Unity Catalog — query via a JDBC-based Athena connector
- Snowflake — query via the Athena Snowflake connector
- Amazon OpenSearch — project embeddings from OpenSearch indices
- Any source accessible through Athena federated queries
NetworkX Backend
Section titled “NetworkX Backend”A NetworkX-compatible backend that lets you offload graph algorithm workloads to AWS with no code changes. Use familiar NetworkX APIs to seamlessly scale graph computations on-demand.
import networkx as nx
# Build a small social networkG = nx.DiGraph()G.add_edges_from([ ("Alice", "Bob"), ("Alice", "Carol"), ("Bob", "Carol"), ("Carol", "Dave"), ("Dave", "Alice"),])
# Run PageRank on Neptune Analyticsscores = nx.pagerank(G, backend="neptune")
# Who's most influential?top = sorted(scores.items(), key=lambda x: x[1], reverse=True)for name, score in top: print(f"{name}: {score:.4f}")Use cases
Section titled “Use cases”- Fraud detection — project financial transactions as a graph, run community detection (Louvain) to identify fraud rings
- Product recommendation — project product catalogs with vector embeddings, run similarity search to find related items
Notebooks
Section titled “Notebooks”Interactive Jupyter notebooks demonstrate each feature:
| Category | Notebooks |
|---|---|
| Algorithm demos | PageRank, BFS, Degree, Closeness, Louvain, Label Propagation |
| Data lake | S3 Tables, S3 Vectors, Databricks, Snowflake, OpenSearch |
| Session management | SessionManager, Instance lifecycle |