Convert ArangoDB graphs to NetworkX & vice-versa.
Project description
ArangoDB-Networkx Adapter
The ArangoDB-Networkx Adapter exports Graphs from ArangoDB, a multi-model Graph Database, into NetworkX, the swiss army knife for graph analysis with python, and vice-versa.
About NetworkX
Networkx is a commonly used tool for analysis of network-data. If your analytics use cases require the use of all your graph data, for example, to summarize graph structure, or answer global path traversal queries, then using the ArangoDB Pregel API is recommended. If your analysis pertains to a subgraph, then you may be interested in getting the Networkx representation of the subgraph for one of the following reasons:
1. An algorithm for your use case is available in Networkx.
2. A library that you want to use for your use case works with Networkx Graphs as input.
Quickstart
import networkx as nx
from adbnx_adapter.adbnx_adapter import ArangoDB_Networkx_Adapter
con = {
"hostname": "localhost",
"protocol": "http",
"port": 8529,
"username": "root",
"password": "rootpassword",
"dbName": "_system",
}
adbnx_adapter = ArangoDB_Networkx_Adapter(con)
# (Assume ArangoDB fraud-detection data dump is imported)
fraud_nx_g = adbnx_adapter.arangodb_graph_to_networkx("fraud-detection")
fraud_nx_g_2 = adbnx_adapter.arangodb_collections_to_networkx(
"fraud-detection",
{"account", "bank", "branch", "Class", "customer"},
{"accountHolder", "Relationship", "transaction"}
)
grid_nx_g = nx.grid_2d_graph(5, 5)
grid_edge_definitions = [
{
"edge_collection": "to",
"from_vertex_collections": ["Grid_Node"],
"to_vertex_collections": ["Grid_Node"],
}
]
adb_g = adbnx_adapter.networkx_to_arangodb("Grid", grid_nx_g, grid_edge_definitions)
Development & Testing
Prerequisite: arangorestore must be installed
git clone https://github.com/arangoml/networkx-adapter.gitcd networkx-adapterpython -m venv .venvsource .venv/bin/activate(MacOS) or.venv/scripts/activate(Windows)cd adbnx_adapterpip install -e . pytestpytest- If you encounter
ModuleNotFoundError, try closing & relaunching your virtual environment by runningdeactivatein your terminal & restarting from Step 4.
- If you encounter
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file adbnx_adapter-2.0.0.tar.gz.
File metadata
- Download URL: adbnx_adapter-2.0.0.tar.gz
- Upload date:
- Size: 3.5 MB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.7.0 importlib_metadata/4.8.2 pkginfo/1.8.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.8.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
cb35a90b31fe61f9faf3542f7db882a5c1b2c3adff0958f5a7aa76aef50f20d3
|
|
| MD5 |
edf6876ffe743ad19731a43c87f03528
|
|
| BLAKE2b-256 |
a7ef0837a947b5c9f21c63c952035e2fa5c86ac1cd94e1123b3593ac2ca4908e
|
File details
Details for the file adbnx_adapter-2.0.0-py3-none-any.whl.
File metadata
- Download URL: adbnx_adapter-2.0.0-py3-none-any.whl
- Upload date:
- Size: 9.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.7.0 importlib_metadata/4.8.2 pkginfo/1.8.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.8.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
32fdaea5c903361ab43e23009c60ee0f8164f09302edfc05108f8ada0972f42d
|
|
| MD5 |
1c1b25bd6b0125d3f02c0acc4c113fd3
|
|
| BLAKE2b-256 |
b1edc85ef38fdc166dc66a93dfad2057f234c418a2885dfcc0a549c33a819ab4
|