Syntax overview

This section describes the general syntax for running algorithms in the Neo4j Graph Data Science library, including execution modes and common configuration parameters.

The general algorithm syntax involves referencing a previously loaded named graph.

Additionally, different execution modes are provided:

  • stream

    • Returns the result of the algorithm as a stream of records.

  • stats

    • Returns a single record of summary statistics, but does not write to the Neo4j database.

  • mutate

    • Writes the results of the algorithm to the projected graph and returns a single record of summary statistics.

  • write

    • Writes the results of the algorithm to the Neo4j database and returns a single record of summary statistics.

Finally, an execution mode may be estimated by appending the command with estimate.

Only the production-quality tier guarantees availability of all execution modes and estimation procedures.

Including all of the above mentioned elements leads to the following syntax outline:

Syntax composition:
CALL gds[.<tier>].<algorithm>.<execution-mode>[.<estimate>](
  graphName: String,
  configuration: Map
)

When using the estimation mode it is also possible to inline the graph creation into the algorithm configuration and omit the graph name. The syntax looks as follows:

Syntax composition for memory estimation:
CALL gds[.<tier>].<algorithm>.<execution-mode>.estimate(
  configuration: Map
)

The detailed sections in this chapter include concrete syntax overviews and examples.