Skip to content

Commit

Permalink
Merge pull request #89 from adamnsch/1.0.0-pre-release-actions
Browse files Browse the repository at this point in the history
1.0.0 pre-release actions
  • Loading branch information
adamnsch authored Mar 24, 2022
2 parents d8308ea + 6f3e36d commit 7b85555
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 23 deletions.
38 changes: 17 additions & 21 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,12 @@ It enables users to write pure Python code to project graphs, run algorithms, as
The API is designed to mimic the GDS Cypher procedure API in Python code.
It abstracts the necessary operations of the [Neo4j Python driver](https://neo4j.com/docs/python-manual/current/) to offer a simpler surface.

`graphdatascience` is only guaranteed to work with GDS versions 2.0+.

Please leave any feedback as issues on [the source repository](https://github.com/neo4j/graph-data-science-client).
Happy coding!


## NOTE

This is a work in progress and some GDS features are known to be missing or not working properly (see [Known limitations](#known-limitations) below).
Further, this library targets GDS versions 2.0+ (not yet released) and as such may not work with older versions.


## Installation

To install the latest deployed version of `graphdatascience`, simply run:
Expand All @@ -28,7 +24,7 @@ pip install graphdatascience
## Usage

What follows is a high level description of some of the operations supported by `graphdatascience`.
For extensive documentation of all capabilities, please refer to the [Python client chapter of the GDS Manual](https://neo4j.com/docs/graph-data-science/2.0-preview/python-client/).
For extensive documentation of all capabilities, please refer to the [Python client chapter of the GDS Manual](https://neo4j.com/docs/graph-data-science/current/python-client/).

Extensive end-to-end examples in Jupyter ready-to-run notebooks can be found in the [`examples` source directory](https://github.com/neo4j/graph-data-science-client/tree/main/examples):

Expand All @@ -37,7 +33,7 @@ Extensive end-to-end examples in Jupyter ready-to-run notebooks can be found in

### Imports and setup

The library wraps the [Neo4j Python driver](https://neo4j.com/docs/python-manual/2.0-preview/) with a `GraphDataScience` object through which most calls to GDS will be made.
The library wraps the [Neo4j Python driver](https://neo4j.com/docs/python-manual/current/) with a `GraphDataScience` object through which most calls to GDS will be made.

```python
from graphdatascience import GraphDataScience
Expand Down Expand Up @@ -70,7 +66,7 @@ gds = GraphDataScience("neo4j+s://my-aura-ds.databases.neo4j.io:7687", auth=("ne

### Projecting a graph

Supposing that we have some graph data in our Neo4j database, we can [project the graph into memory](https://neo4j.com/docs/graph-data-science/2.0-preview/graph-project/).
Supposing that we have some graph data in our Neo4j database, we can [project the graph into memory](https://neo4j.com/docs/graph-data-science/current/graph-project/).

```python
# Optionally we can estimate memory of the operation first
Expand All @@ -83,12 +79,12 @@ assert res["projectMillis"] >= 0

The `G` that is returned here is a `Graph` which on the client side represents the projection on the server side.

The analogous calls `gds.graph.project.cypher{,.estimate}` for [Cypher based projection](https://neo4j.com/docs/graph-data-science/2.0-preview/graph-project-cypher/) are also supported.
The analogous calls `gds.graph.project.cypher{,.estimate}` for [Cypher based projection](https://neo4j.com/docs/graph-data-science/current/graph-project-cypher/) are also supported.


### Running algorithms

We can take a projected graph, represented to us by a `Graph` object named `G`, and run [algorithms](https://neo4j.com/docs/graph-data-science/2.0-preview/algorithms/) on it.
We can take a projected graph, represented to us by a `Graph` object named `G`, and run [algorithms](https://neo4j.com/docs/graph-data-science/current/algorithms/) on it.

```python
# Optionally we can estimate memory of the operation first (if the algo supports it)
Expand All @@ -100,16 +96,16 @@ assert res["nodePropertiesWritten"] == G.node_count()
```

These calls take one positional argument and a number of keyword arguments depending on the algorithm.
The first (positional) argument is a `Graph`, and the keyword arguments map directly to the algorithm's [configuration map](https://neo4j.com/docs/graph-data-science/2.0-preview/common-usage/running-algos/#algorithms-syntax-configuration-parameters).
The first (positional) argument is a `Graph`, and the keyword arguments map directly to the algorithm's [configuration map](https://neo4j.com/docs/graph-data-science/current/common-usage/running-algos/#algorithms-syntax-configuration-parameters).

The other [algorithm execution modes](https://neo4j.com/docs/graph-data-science/2.0-preview/common-usage/running-algos/) - stats, stream and write - are also supported via analogous calls.
The other [algorithm execution modes](https://neo4j.com/docs/graph-data-science/current/common-usage/running-algos/) - stats, stream and write - are also supported via analogous calls.
The stream mode call returns a pandas DataFrame (with contents depending on the algorithm of course).
The mutate, stats and write mode calls however return a pandas Series with metadata about the algorithm execution.


#### Topological link prediction

The methods for doing [topological link prediction](https://neo4j.com/docs/graph-data-science/2.0-preview/algorithms/linkprediction/) are a bit different.
The methods for doing [topological link prediction](https://neo4j.com/docs/graph-data-science/current/algorithms/linkprediction/) are a bit different.
Just like in the GDS procedure API they do not take a graph as an argument, but rather two node references as positional arguments.
And they simply return the similarity score of the prediction just made as a float - not any kind of pandas data structure.

Expand Down Expand Up @@ -144,7 +140,7 @@ This includes support for models trained using pipelines (for Link Prediction an

#### Pipelines

There's native support for [Link prediction pipelines](https://neo4j.com/docs/graph-data-science/2.0-preview/algorithms/ml-models/linkprediction-pipelines/) and [Node classification pipelines](https://neo4j.com/docs/graph-data-science/2.0-preview/algorithms/ml-models/nodeclassification-pipelines/).
There's native support for [Link prediction pipelines](https://neo4j.com/docs/graph-data-science/current/algorithms/ml-models/linkprediction-pipelines/) and [Node classification pipelines](https://neo4j.com/docs/graph-data-science/current/algorithms/ml-models/nodeclassification-pipelines/).
Apart from the call to create a pipeline, the GDS native pipelines calls are represented by methods on pipeline Python objects.
Additionally to the standard GDS calls, there are several methods to query the pipeline for information about it.

Expand Down Expand Up @@ -192,7 +188,7 @@ Note that with GraphSAGE we call the `train` method directly and supply all trai

### Graph catalog utils

All procedures from the [GDS Graph catalog](https://neo4j.com/docs/graph-data-science/2.0-preview/management-ops/graph-catalog-ops/) are supported with `graphdatascience`.
All procedures from the [GDS Graph catalog](https://neo4j.com/docs/graph-data-science/current/management-ops/graph-catalog-ops/) are supported with `graphdatascience`.
Some examples are (where `G` is a `Graph`):

```python
Expand All @@ -210,7 +206,7 @@ The idea is to have a way of creating `Graph`s for already projected graphs, wit

### Pipeline catalog utils

All procedures from the [GDS Pipeline catalog](https://neo4j.com/docs/graph-data-science/2.0-preview/pipeline-catalog/) are supported with `graphdatascience`.
All procedures from the [GDS Pipeline catalog](https://neo4j.com/docs/graph-data-science/current/pipeline-catalog/) are supported with `graphdatascience`.
Some examples are (where `pipe` is a machine learning training pipeline object):

```python
Expand All @@ -228,7 +224,7 @@ The idea is to have a way of creating pipeline objects for already existing pipe

### Model catalog utils

All procedures from the [GDS Model catalog](https://neo4j.com/docs/graph-data-science/2.0-preview/model-catalog/) are supported with `graphdatascience`.
All procedures from the [GDS Model catalog](https://neo4j.com/docs/graph-data-science/current/model-catalog/) are supported with `graphdatascience`.
Some examples are (where `model` is a machine learning model object):

```python
Expand All @@ -247,7 +243,7 @@ The idea is to have a way of creating model objects for already loaded models, w
### Node matching without Cypher

When calling path finding or topological link prediction algorithms one has to provide specific nodes as input arguments.
When using the GDS procedure API directly to call such algorithms, typically Cypher `MATCH` statements are used in order to find valid representations of input nodes of interest, see eg. [this example in the GDS docs](https://neo4j.com/docs/graph-data-science/2.0-preview/algorithms/dijkstra-source-target/#algorithms-dijkstra-source-target-examples-stream).
When using the GDS procedure API directly to call such algorithms, typically Cypher `MATCH` statements are used in order to find valid representations of input nodes of interest, see eg. [this example in the GDS docs](https://neo4j.com/docs/graph-data-science/current/algorithms/dijkstra-source-target/#algorithms-dijkstra-source-target-examples-stream).
To simplify this, `graphdatascience` provides a utility function, `gds.find_node_id`, for letting one find nodes without using Cypher.

Below is an example of how this can be done (supposing `G` is a projected `Graph` with `City` nodes having `name` properties):
Expand All @@ -272,8 +268,8 @@ For more advanced filtering we recommend users do matching via Cypher's `MATCH`.

Operations known to not yet work with `graphdatascience`:

* [Numeric utility functions](https://neo4j.com/docs/graph-data-science/2.0-preview/management-ops/utility-functions/#utility-functions-numeric) (will never be supported)
* [Cypher on GDS](https://neo4j.com/docs/graph-data-science/2.0-preview/management-ops/create-cypher-db/) (might be supported in the future)
* [Numeric utility functions](https://neo4j.com/docs/graph-data-science/current/management-ops/utility-functions/#utility-functions-numeric) (will never be supported)
* [Cypher on GDS](https://neo4j.com/docs/graph-data-science/current/management-ops/create-cypher-db/) (might be supported in the future)


## License
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion graphdatascience/version.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = "0.1.1"
__version__ = "1.0.0"
3 changes: 2 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
version = f.readline().strip().split()[-1][1:-1]

classifiers = [
"Development Status :: 5 - Production/Stable",
"Intended Audience :: Developers",
"Intended Audience :: Science/Research",
"License :: OSI Approved :: Apache Software License",
Expand All @@ -22,7 +23,7 @@
]

project_urls = {
"Documentation": "https://neo4j.com/docs/graph-data-science/2.0-preview/python-client/",
"Documentation": "https://neo4j.com/docs/graph-data-science/current/python-client/",
"Source": "https://github.com/neo4j/graph-data-science-client",
"Bug Tracker": "https://github.com/neo4j/graph-data-science-client/issues",
}
Expand Down

0 comments on commit 7b85555

Please sign in to comment.