Skip to main content

NebulaGraph Data Intelligence Suite

Project description

image

Data Intelligence Suite with 4 line code to run Graph Algo on NebulaGraph

License PyPI version Python pdm-managed


Documentation: https://github.com/wey-gu/nebulagraph-di#documentation

Source Code: https://github.com/wey-gu/nebulagraph-di


NebulaGraph Data Intelligence Suite for Python (ngdi) is a powerful Python library that offers APIs for data scientists to effectively read, write, analyze, and compute data in NebulaGraph.

With the support of single-machine engine(NetworkX), or distributed computing environment using Spark we could perform Graph Analysis and Algorithms on top of NebulaGraph in less than 10 lines of code, in unified and intuitive API.

Quick Start in 5 Minutes

Installation

pip install ngdi

Usage

Spark Engine Examples

See also: examples/spark_engine.ipynb

Run Algorithm on top of NebulaGraph:

Note, there is also query mode, refer to examples or docs for more details.

from ngdi import NebulaReader

# read data with spark engine, scan mode
reader = NebulaReader(engine="spark")
reader.scan(edge="follow", props="degree")
df = reader.read()

# run pagerank algorithm
pr_result = df.algo.pagerank(reset_prob=0.15, max_iter=10)

Write back to NebulaGraph:

from ngdi import NebulaWriter
from ngdi.config import NebulaGraphConfig

config = NebulaGraphConfig()

properties = {"louvain": "cluster_id"}

writer = NebulaWriter(
    data=df_result, sink="nebulagraph_vertex", config=config, engine="spark")
writer.set_options(
    tag="louvain", vid_field="_id", properties=properties,
    batch_size=256, write_mode="insert",)
writer.write()

Then we could query the result in NebulaGraph:

MATCH (v:louvain)
RETURN id(v), v.louvain.cluster_id LIMIT 10;

NebulaGraph Engine Examples(not yet implemented)

Basically the same as Spark Engine, but with engine="nebula".

- reader = NebulaReader(engine="spark")
+ reader = NebulaReader(engine="nebula")

Documentation

Environment Setup

API Reference

How it works

ngdi is an unified abstraction layer for different engines, the current implementation is based on Spark, NetworkX, DGL and NebulaGraph, but it's easy to extend to other engines like Flink, GraphScope, PyG etc.

        ┌───────────────────────────────────────────────────┐            
        │   Spark Cluster                                   │            
        │    .─────.    .─────.    .─────.    .─────.       │            
     ┌─▶│   :       ;  :       ;  :       ;  :       ;      │            
     │  │     `───'      `───'      `───'      `───'        │            
Algorithm                                                   │            
  Spark └───────────────────────────────────────────────────┘            
 Engine ┌────────────────────────────────────────────────────────────────┐
     └──┤                                                                │
        │   NebulaGraph Data Intelligence Suite(ngdi)                    │
        │     ┌────────┐    ┌──────┐    ┌────────┐   ┌─────┐             │
        │     │ Reader │    │ Algo │    │ Writer │   │ GNN │             │
        │     └────────┘    └──────┘    └────────┘   └─────┘             │
        │          ├────────────┴───┬────────┴─────┐    └──────┐         │
        │          ▼                ▼              ▼           ▼         │
        │   ┌─────────────┐ ┌──────────────┐ ┌──────────┐┌───────────┐   │
     ┌──┤   │ SparkEngine │ │ NebulaEngine │ │ NetworkX ││ DGLEngine │   │
     │  │   └─────────────┘ └──────────────┘ └──────────┘└───────────┘   │
     │  └──────────┬─────────────────────────────────────────────────────┘
     │             │        Spark                                        
     │             └────────Reader ────────────┐                         
Spark Reader              Query Mode           │                         
Scan Mode                                      ▼                         
     │  ┌───────────────────────────────────────────────────┐            
     │  │  NebulaGraph Graph Engine         Nebula-GraphD   │            
     │  ├──────────────────────────────┬────────────────────┤            
     │  │  NebulaGraph Storage Engine  │                    │            
     └─▶│  Nebula-StorageD             │    Nebula-Metad    │            
        └──────────────────────────────┴────────────────────┘            

Spark Engine Prerequisites

NebulaGraph Engine Prerequisites

License

This project is licensed under the terms of the Apache License 2.0.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ngdi-0.2.2.tar.gz (16.2 kB view details)

Uploaded Source

Built Distribution

ngdi-0.2.2-py3-none-any.whl (17.6 kB view details)

Uploaded Python 3

File details

Details for the file ngdi-0.2.2.tar.gz.

File metadata

  • Download URL: ngdi-0.2.2.tar.gz
  • Upload date:
  • Size: 16.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: pdm/2.4.6 CPython/3.8.10

File hashes

Hashes for ngdi-0.2.2.tar.gz
Algorithm Hash digest
SHA256 215042171cf5e2038e6c749263cb91ffdf2ec6de4444daa968255820e289c7ed
MD5 d33a71fe43fc005f3e8ca8b222c4f3d7
BLAKE2b-256 a9b98f9eb4ce10972ee373dbdde7738ce1cba3dbf5ad0b182c4004e65988d1e1

See more details on using hashes here.

File details

Details for the file ngdi-0.2.2-py3-none-any.whl.

File metadata

  • Download URL: ngdi-0.2.2-py3-none-any.whl
  • Upload date:
  • Size: 17.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: pdm/2.4.6 CPython/3.8.10

File hashes

Hashes for ngdi-0.2.2-py3-none-any.whl
Algorithm Hash digest
SHA256 442ecb4638546365131c97cf5c2981ff859e527320bccc121a66e7517633d2d7
MD5 b305a5ac036344f118ba60a3e3b8c025
BLAKE2b-256 1222044594ec061b61855c16bb4d64520c77ca8db74881ab89170daec8ca761c

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page