gdsclient
NOTE: This is a work in progress and many GDS features are known to be missing or not working properly.
This repo hosts the sources for gdsclient
, a Python wrapper API for operating and working with the Neo4j Graph Data Science (GDS) library. gdsclient enables users to write pure Python code to project graphs, run algorithms, and define and use machine learning pipelines in GDS. The API is designed to mimic the GDS Cypher procedure API, but in Python code. It abstracts the necessary operation of the Neo4j Python Driver to offer a simpler surface.
Please leave any feedback as issues on this repository. Happy coding!
Installation
To build and install gdsclient
from this repository, simply run the following command:
pip3 install .
Documentation
A minimal example of using gdsclient
to connect to a Neo4j database and run GDS algorithms:
from neo4j import GraphDatabase
from gdsclient import Neo4jQueryRunner, GraphDataScience
# Set up driver and gds module
URI = "bolt://localhost:7687" # Override according to your setup
driver = GraphDatabase.driver(URI) # You might also have auth set up in your db
runner = Neo4jQueryRunner(driver)
gds = GraphDataScience(runner)
# Project your graph
graph = gds.graph.create("graph", "*", "*")
# Run the PageRank algorithm with custom configuration
gds.pageRank.write(graph, tolerance=0.5, writeProperty="pagerank")
For extensive documentation of all operations supported by GDS, please refer to the GDS Manual.
Extensive end-to-end examples in Jupyter ready-to-run notebooks can be found in the examples
directory:
Acknowledgements
This work has been inspired by the great work done in the following libraries:
- pygds by stellasia
- gds-python by moxious
Contributing
The gdsclient
project does not yet have contribution guidelines.
License
See LICENSE file. All content is copyright © Neo4j Sweden AB.