Arjunp24 / networkx-adapter

NetworkX Adapter for ArangoDB.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

ArangoDB-Networkx Adapter

The ArangoDB-Networkx Adapter export Graphs from ArangoDB, a multi-model Graph Database into NetworkX, the swiss army knife for graph analysis with python.

Quickstart

To get started quickly you just use this setup free jupyter notebook: Open In Colab

To get started in custom code:

pip install adbnx_adapter
import networkx as nx
from adbnx_adapter.arangoDB_networkx_adapter import ArangoDB_Networkx_Adapter

# Specify the connection to the ArangoDB Database
con = {'dbName': 'YOURDBNAME',
 'username': 'YOURUSERNAME',
 'password': 'YOURPASSOWRD',
 'hostname': 'instance.arangodb.cloud',
 'port': 8529}

# Create Adapter instance
ma = ArangoDB_Networkx_Adapter(conn = con)

# Specify attributes to be imported
attributes = { 'vertexCollections':
                                  {'account': {'Balance', 'account_type', 'customer_id', 'rank'}},\
                               'edgeCollections' :
                                  {'accountHolder': {'_from', '_to'},\
                                   'transaction': {'_from', '_to'}}}

# Export networkX graph                                  
g = ma.create_networkx_graph(graph_name = 'FraudDetection',  graph_attributes = attributes)

# Use networkX
nx.draw(g, with_labels=True)

Introduction

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.

Check the DGL folder for an implementation of a Networkx-Adapter for the Deep Graph Library.

About

NetworkX Adapter for ArangoDB.

License:Apache License 2.0


Languages

Language:Python 100.0%