https://github.com/awslabs/nx-neptune

NetworkX.org backend using Amazon Neptune Analytics

https://github.com/awslabs/nx-neptune

Science Score: 26.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
    Found .zenodo.json file
  • DOI references
  • Academic publication links
  • Academic email domains
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (13.2%) to scientific vocabulary
Last synced: 9 months ago · JSON representation

Repository

NetworkX.org backend using Amazon Neptune Analytics

Basic Info
  • Host: GitHub
  • Owner: awslabs
  • License: apache-2.0
  • Language: Python
  • Default Branch: main
  • Homepage:
  • Size: 1.84 MB
Statistics
  • Stars: 7
  • Watchers: 1
  • Forks: 0
  • Open Issues: 2
  • Releases: 7
Created 11 months ago · Last pushed 10 months ago
Metadata Files
Readme Changelog Contributing License Code of conduct Notice

README.md


nx_neptune

CI Upload Python Package

This project offers a NetworkX-compatible backend for Neptune Analytics, enabling users to offload graph algorithm workloads to AWS with no code changes. By using familiar NetworkX APIs, developers can seamlessly scale graph computations on-demand through Neptune Analytics. This approach combines the simplicity of local development with the performance and scalability of a fully managed AWS graph analytics service.

Preview Status: Alpha Release

We're making the nx_neptune plugin library an open-source project, and are releasing it now as an Alpha Preview to the community to gather feedback, and actively collaborate on the project roadmap. We welcome questions, suggestions, and contributions from all community members. At this point in development, the project has not been fully released to the public and is recommended for testing purposes only. We're tracking its production readiness for general availability on the roadmap.

Installation

Note, as part of the preview status, the project is not yet published to PyPI. Please install from wheel or source.

Install it from PyPI

bash pip install nx_neptune

Build and install from package wheel

```bash

Package the project from source:

python -m pip wheel -w dist .

Install with Jupyter dependencies from wheel:

pip install "dist/nx_neptune-0.4.1-py3-none-any.whl" ```

Installation

To install the required nx_neptune dependencies:

```bash git clone git@github.com:awslabs/nx-neptune.git cd nx-neptune

install from source directly

make install ```

Prerequisite

Before using this backend, ensure the following prerequisites are met:

AWS IAM Permissions

The IAM role or user accessing Neptune Analytics must have the following permissions:

These permissions are required to read, write, and manage graph data via queries on Neptune Analytics:

  • neptune-graph:ReadDataViaQuery
  • neptune-graph:WriteDataViaQuery
  • neptune-graph:DeleteDataViaQuery

These permissions are required to import/export between S3 and Neptune Analytics:

  • s3:GetObject (for import)
  • s3:PutObject (for export)
  • s3:ListBucket (for export)
  • kms:Decrypt
  • kms:GenerateDataKey
  • kms:DescribeKey

The ARN with the above permissions must be added to your environment variables

Python Runtime

  • Python 3.11 is required.
  • Ensure your environment uses Python 3.11 to maintain compatibility with dependencies and API integrations.

Note: As part of the preview status, we are recommending that you run the library using Python 3.11.

Usage

```py import networkx as nx

G = nx.Graph() G.addnode("Bill") G.addnode("John") G.add_edge("Bill", "John")

r = nx.pagerank(G, backend="neptune") ```

And run with:

```bash

Set the NETWORKXGRAPHID environment variable

export NETWORKXGRAPHID=your-neptune-analytics-graph-id python ./nx_example.py ```

Alternatively, you can pass the NETWORKX_GRAPH_ID directly:

bash NETWORKX_GRAPH_ID=your-neptune-analytics-graph-id python ./nx_example.py `

Without a valid NETWORKX_GRAPH_ID, the examples will fail to connect to your Neptune Analytics instance. Make sure your AWS credentials are properly configured and your IAM role/user has the required permissions (ReadDataViaQuery, WriteDataViaQuery, DeleteDataViaQuery).

Jupyter Notebook Integration

For interactive exploration and visualization, you can use the Jupyter notebook integration.

Features

The notebooks directory contains interactive demonstrations of using Neptune Analytics with NetworkX:

Uploading a package wheel

We recommend uploading your package as a wheel to Jupyter Notebooks.

```bash

Package the project from source:

python -m pip wheel -w dist .

creates dist/nx_neptune-0.4.1-py3-none-any.whl

```

Installation

To install the required dependencies for the Jupyter notebook (including the Jupyter dependencies):

```bash

Install with Jupyter dependencies from wheel:

pip install "dist/nx_neptune-0.4.1-py3-none-any.whl[jupyter]" ```

Running the Jupyter Notebook

A full tutorial is available to run in Neptune Jupyter Notebooks.

To run the Jupyter notebooks:

  1. Set your Neptune Analytics Graph ID as an environment variable: bash export NETWORKX_GRAPH_ID=your-neptune-analytics-graph-id

  2. You will also need to specify the IAM roles that will execute S3 import or export:

bash export NETWORKX_ARN_IAM_ROLE=arn:aws:iam::AWS_ACCOUNT:role/IAM_ROLE_NAME export NETWORKX_S3_IMPORT_BUCKET_PATH=s://S3_BUCKET_PATH export NETWORKX_S3_EXPORT_BUCKET_PATH=s://S3_BUCKET_PATH

  1. Launch Jupyter Notebook: bash jupyter notebook notebooks/

  2. You can also set the Graph ID directly in the notebook using: python %env NETWORKX_GRAPH_ID=your-neptune-analytics-graph-id

Security

See CONTRIBUTING for more information.

License

This project is licensed under the Apache-2.0 License.

Owner

  • Name: Amazon Web Services - Labs
  • Login: awslabs
  • Kind: organization
  • Location: Seattle, WA

AWS Labs

GitHub Events

Total
  • Release event: 2
  • Watch event: 4
  • Push event: 3
  • Pull request event: 5
  • Pull request review comment event: 1
  • Pull request review event: 5
  • Create event: 5
Last Year
  • Release event: 2
  • Watch event: 4
  • Push event: 3
  • Pull request event: 5
  • Pull request review comment event: 1
  • Pull request review event: 5
  • Create event: 5

Issues and Pull Requests

Last synced: 10 months ago

All Time
  • Total issues: 1
  • Total pull requests: 3
  • Average time to close issues: N/A
  • Average time to close pull requests: 4 days
  • Total issue authors: 1
  • Total pull request authors: 2
  • Average comments per issue: 0.0
  • Average comments per pull request: 0.67
  • Merged pull requests: 1
  • Bot issues: 1
  • Bot pull requests: 0
Past Year
  • Issues: 1
  • Pull requests: 3
  • Average time to close issues: N/A
  • Average time to close pull requests: 4 days
  • Issue authors: 1
  • Pull request authors: 2
  • Average comments per issue: 0.0
  • Average comments per pull request: 0.67
  • Merged pull requests: 1
  • Bot issues: 1
  • Bot pull requests: 0
Top Authors
Issue Authors
  • dependabot[bot] (1)
Pull Request Authors
  • acarbonetto (2)
  • mykola-pereyma (1)
Top Labels
Issue Labels
dependencies (1) github_actions (1)
Pull Request Labels

Packages

  • Total packages: 1
  • Total downloads:
    • pypi 56 last-month
  • Total dependent packages: 0
  • Total dependent repositories: 0
  • Total versions: 2
  • Total maintainers: 1
pypi.org: nx-neptune

Neptune computation backend for NetworkX

  • Versions: 2
  • Dependent Packages: 0
  • Dependent Repositories: 0
  • Downloads: 56 Last month
Rankings
Dependent packages count: 8.6%
Average: 28.6%
Dependent repos count: 48.6%
Maintainers (1)
Last synced: 10 months ago

Dependencies

.github/workflows/main.yml actions
  • actions/checkout v5 composite
  • actions/github-script v7 composite
  • actions/setup-python v5 composite
  • actions/upload-artifact v4 composite
.github/workflows/python-prerelease.yml actions
  • actions/checkout v4 composite
  • actions/setup-python v5 composite
  • actions/upload-artifact v4 composite
.github/workflows/python-publish.yml actions
  • actions/checkout v4 composite
  • actions/download-artifact v4 composite
  • actions/setup-python v5 composite
  • actions/upload-artifact v4 composite
  • pypa/gh-action-pypi-publish release/v1 composite
pyproject.toml pypi
  • boto3 >=1.37,<2.0
  • cymple >=0.12.0,<1.0.0
  • networkx >=3.4.2,<4.0.0