Migration from the 1.x series
Version 2.0 of the GDS Python Client makes the V2 API the default and only API of the client.
The V2 API was previously available in the 1.x series under the gds.v2 prefix; as of 2.0 the prefix is gone and all endpoints are called directly on the gds object.
Compared to the 1.x API, the client provides a more modern, type-safe, and intuitive way to interact with the Neo4j Graph Data Science library with a few key features:
-
Explicit parameters: Functions now use named, typed parameters instead of a generic
configdictionary, making code more readable and self-documenting. -
Type-safe results: Instead of generic Pandas
Seriesobjects, endpoints return dedicated result types, enabling better static analysis and IDE integration. -
Pythonic naming: Transitioning from camelCase to snake_case for algorithm and parameter names.
-
Improved autocompletion: Better IDE support for discovering available endpoints and their sub-commands.
This page describes the changes needed to migrate code written against the 1.x series.
Requirements
-
The minimum supported Neo4j Python driver version is now
5.26.0. The Neo4j4.4driver is no longer supported.
Migrating from the gds.v2 preview prefix
If your code already uses the V2 endpoints via the gds.v2 prefix, migration only requires dropping the prefix:
# 1.x preview
result = gds.v2.page_rank.stream(G, damping_factor=0.5)
# 2.0
result = gds.page_rank.stream(G, damping_factor=0.5)
All other semantics are unchanged.
Migrating from the 1.x default API
Migrating code that uses the classic 1.x endpoints involves a few straightforward changes:
-
Standardize naming: Convert algorithm and parameter names from camelCase to snake_case (for example, replace
pageRankwithpage_rankanddampingFactorwithdamping_factor). -
Drop tier prefixes: The
gds.alphaandgds.betanamespaces no longer exist; all endpoints are called at their top-level name (for example, replacegds.beta.graphSage.trainwithgds.graph_sage.train). -
Use typed results: The
stats,mutate,writeandtrainmodes return typed result objects instead of a pandasSeries. Access result fields directly as snake_case attributes on the returned object instead of using string keys (for example, replaceresult["writeMillis"]withresult.write_millis). Thestreammode still returns a pandasDataFrame.
| 1.x | 2.0 |
|---|---|
|
|
|
|
|
|
Graph projections
The projection endpoints have been renamed to make the projection type explicit:
-
Native projection:
gds.graph.projectis nowgds.graph.project.nativefor Plugin GDS and AuraDS andgds.graph.project.cypherfor Aura Graph Analytics. -
Cypher projection:
gds.graph.cypher.projectis nowgds.graph.project.cypher. -
The legacy Cypher projection (the 1.x
gds.graph.project.cypherendpoint) has been removed. Note that the namegds.graph.project.cyphernow refers to the aggregation-based Cypher projection instead. See Projecting a graph using Cypher projection for details.
Both projection endpoints return a tuple of a graph object and a typed result object, for example GraphProjectResult, instead of a pandas Series.
| 1.x | 2.0 |
|---|---|
|
|
|
|
Machine learning pipelines and models
Pipelines are now created via the gds.pipeline namespace, and the pipeline and model objects expose snake_case methods:
-
gds.beta.pipeline.nodeClassification.create(or thegds.nc_pipeshorthand) is nowgds.pipeline.node_classification.create. -
gds.beta.pipeline.linkPrediction.create(or thegds.lp_pipeshorthand) is nowgds.pipeline.link_prediction.create. -
Methods on pipeline objects follow snake_case, for example
addNodePropertyis nowadd_node_propertyandselectFeaturesis nowselect_features. -
GraphSAGE training moved from
gds.beta.graphSage.traintogds.graph_sage.train, and trained models are retrieved withgds.graph_sage.getinstead ofgds.model.get. -
To access a model use the model specific getters, e.g.
gds.graph_sage.get, instead ofgds.model.get -
Model catalog operations are available directly on the model object, for example
model.store(),model.load()andmodel.drop()instead ofgds.model.store(model),gds.model.load(model.name())andgds.model.drop(model).
See Machine learning pipelines and Model objects from the model catalog for the full API.