Running GDS algorithms from Python and extracting data in a dataframe
In a preceding chapter, we learned that GDS algorithms offer multiple run modes, depending on where we want the results to be saved. In stream
mode, the algorithm results are just streamed to the user, who has to decide what to do with them. In write
mode, the results are persisted in the Neo4j database. Finally, mutate
mode will update the in-memory projected graph with the results, which will be lost when the Neo4j instance is restarted, just like all the projected graphs. In this section, we will look at write
and stream
modes.
The code for the next paragraph is available in the Running_Algorithms_From_Python
notebook.
write mode
As we just mentioned, when calling a GDS algorithm in write
mode, the results of the algorithm computation will be written back to the main Neo4j graph. This is the only way to persist a result when the Neo4j server is restarted. The result can be either of the following: