@@ -25,12 +25,12 @@ example].
2525
2626== Prerequisites
2727
28- This notebook requires having a Neo4j instance instance available and
29- that the Graph Analytics Serverless
28+ This notebook requires having a Neo4j instance available and that the
29+ Graph Analytics Serverless
3030https://neo4j.com/docs/aura/graph-analytics/#aura-gds-serverless[feature]
3131is enabled for your Neo4j Aura project.
3232
33- We also need to have the `graphdatascience` Python library installed,
33+ You also need to have the `graphdatascience` Python library installed,
3434version `1.15` or later.
3535
3636[source, python, role=no-test]
@@ -40,12 +40,9 @@ version `1.15` or later.
4040
4141== Aura API credentials
4242
43- A GDS Session is managed via the Aura API. In order to use the Aura API,
44- we need to have https://neo4j.com/docs/aura/api/authentication[Aura API
45- credentials].
46-
47- Using these credentials, we can create our `GdsSessions` object, which
48- is the main entry point for managing GDS Sessions.
43+ The entry point for managing GDS Sessions is the `GdsSessions` object,
44+ which requires creating
45+ https://neo4j.com/docs/aura/api/authentication[Aura API credentials].
4946
5047[source, python, role=no-test]
5148----
@@ -64,24 +61,18 @@ sessions = GdsSessions(api_credentials=AuraAPICredentials(client_id, client_secr
6461
6562== Creating a new session
6663
67- A new session is created by calling `sessions.get++_++or++_++create()`.
68- As the data source, we assume that a self-managed Neo4j DBMS instance
69- has been set up and is accessible. We need to pass the database address,
70- user name and password to the `DbmsConnectionInfo` class.
64+ A new session is created by calling `sessions.get++_++or++_++create()`
65+ with the following parameters: ++*++ A session name, which lets you
66+ reconnect to an existing session by calling `get++_++or++_++create`
67+ again. ++*++ The `DbmsConnectionInfo` containing the address, user name
68+ and password for an accessible self-manged Neo4j DBMS instance ++*++ The
69+ session memory. ++*++ The cloud location. ++*++ A time-to-live (TTL),
70+ which ensures that the session is automatically deleted after being
71+ unused for the set time, to avoid incurring costs.
7172
72- We also need to specify the session `memory` and `cloud++_++location`.
73- Please refer to the API reference
73+ See the API reference
7474https://neo4j.com/docs/graph-data-science-client/current/api/sessions/gds_sessions/#graphdatascience.session.gds_sessions.GdsSessions.get_or_create[documentation]
75- or the manual for a full list options.
76-
77- Finally, we need to give our session a name. We will call ours
78- `people-and-fruits-sm'. It is possible to reconnect to an existing session by calling`get++_++or++_++create++`++
79- with the same session name and configuration.
80-
81- We will also set a time-to-live (TTL) for the session. This ensures that
82- our session is automatically deleted after being unused for 30 minutes.
83- This is a good practice to avoid incurring costs should we forget to
84- delete the session ourselves.
75+ or the manual for more details on the parameters.
8576
8677[source, python, role=no-test]
8778----
@@ -121,7 +112,7 @@ db_connection = DbmsConnectionInfo(
121112
122113# Create a GDS session!
123114gds = sessions.get_or_create(
124- # we give it a representative name
115+ # give it a representative name
125116 session_name="people-and-fruits-sm",
126117 memory=memory,
127118 db_connection=db_connection,
@@ -132,8 +123,8 @@ gds = sessions.get_or_create(
132123
133124== Listing sessions
134125
135- Now that we have created a session, let’s list all our sessions to see
136- what that looks like
126+ You can use `sessions.list()` to see the details for each created
127+ session.
137128
138129[source, python, role=no-test]
139130----
@@ -147,10 +138,10 @@ DataFrame(gds_sessions)
147138
148139== Adding a dataset
149140
150- We assume that the configured Neo4j database instance is empty. We will
151- add our dataset using standard Cypher.
141+ We assume that the configured Neo4j database instance is empty. You will
142+ add the dataset using standard Cypher.
152143
153- In a more realistic scenario, this step is already done, and we would
144+ In a more realistic scenario, this step is already done, and you would
154145just connect to the existing database.
155146
156147[source, python, role=no-test]
@@ -201,15 +192,15 @@ gds.run_cypher("MATCH (n) RETURN count(n) AS nodeCount")
201192
202193== Projecting Graphs
203194
204- Now that we have imported a graph to our database, we can project it
205- into our GDS Session. We do that by using the `gds.graph.project()`
195+ Now that you have imported a graph to the database, you can project it
196+ into our GDS Session. You do that by using the `gds.graph.project()`
206197endpoint.
207198
208- The remote projection query that we are using selects all `Person` nodes
209- and their `LIKES` relationships, and all `Fruit` nodes and their `LIKES`
210- relationships. Additionally, we project node properties for illustrative
211- purposes. We can use these node properties as input to algorithms,
212- although we do not do that in this notebook.
199+ The remote projection query that you are using selects all `Person`
200+ nodes and their `LIKES` relationships, and all `Fruit` nodes and their
201+ `LIKES` relationships. Additionally, node properties are projected for
202+ illustrative purposes. You can use these node properties as input to
203+ algorithms, although it is note done in this notebook.
213204
214205[source, python, role=no-test]
215206----
@@ -246,12 +237,8 @@ str(G)
246237
247238== Running Algorithms
248239
249- We can now run algorithms on the projected graph. This is done using the
250- standard GDS Python Client API. There are many other tutorials covering
251- some interesting things we can do at this step, so we will keep it
252- rather brief here.
253-
254- We will simply run PageRank and FastRP on the graph.
240+ You can run algorithms on the constructed graph using the standard GDS
241+ Python Client API. See the other tutorials for more examples.
255242
256243[source, python, role=no-test]
257244----
@@ -289,15 +276,15 @@ the PageRank and FastRP algorithms to the Neo4j database.
289276gds.graph.nodeProperties.write(G, ["pagerank", "fastRP"])
290277----
291278
292- Of course, we can just use `.write` modes as well. Let’s run Louvain in
279+ Of course, you can just use `.write` modes as well. Let’s run Louvain in
293280write mode to show:
294281
295282[source, python, role=no-test]
296283----
297284gds.louvain.write(G, writeProperty="louvain")
298285----
299286
300- We can now use the `gds.run++_++cypher()` method to query the updated
287+ You can now use the `gds.run++_++cypher()` method to query the updated
301288graph. Note that the `run++_++cypher()` method will run the query on the
302289Neo4j database.
303290
@@ -314,10 +301,10 @@ gds.run_cypher(
314301
315302== Deleting the session
316303
317- Now that we have finished our analysis, we can delete the session. The
318- results that we produced were written back to our Neo4j database, and
319- will not be lost. If we computed additional things that we did not write
320- back, those will be lost.
304+ Now that you have finished the analysis, you can delete the session. The
305+ results that you produced were written back to our Neo4j database, and
306+ will not be lost. If you computed additional things that you did not
307+ write back, those will be lost.
321308
322309Deleting the session will release all resources associated with it, and
323310stop incurring costs.
@@ -339,9 +326,3 @@ sessions.list()
339326# Lastly, let's clean up the database
340327gds.run_cypher("MATCH (n:Person|Fruit) DETACH DELETE n")
341328----
342-
343- == Conclusion
344-
345- And we’re done! We have created a GDS Session, projected a graph, run
346- some algorithms, written back the results, and deleted the session. This
347- is a simple example, but it shows the main steps of using GDS Sessions.
0 commit comments