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 comes in two variants:
Named graph variant
- The graph to operate over will be read from the graph catalog.
Anonymous graph variant
- The graph to operate over will be created and deleted as part of the algorithm execution.
Each syntax variant additionally provides different execution modes.
These are the supported execution modes:
- Returns the result of the algorithm as a stream of records.
- Returns a single record of summary statistics, but does not write to the Neo4j database.
- Writes the results of the algorithm to the in-memory graph and returns a single record of summary statistics.
This mode is designed for the named graph variant, as its effects will be invisible on an anonymous graph.
- 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
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 outlines:
Syntax composition for the named graph variant:
Syntax composition for the anonymous graph variant:
The detailed sections in this chapter include concrete syntax overviews and examples.
6.1.1. Configuration parameters
All algorithms allow adjustment of their runtime characteristics through a set of configuration parameters.
Although some of the parameters are algorithm-specific, many are shared between algorithms and execution modes.
To learn more about algorithm specific parameters and to find out if an algorithm supports a certain parameter, please consult
the algorithm-specific documentation page.
List of the most commonly accepted configuration parameters
- concurrency - Integer
- Controls the parallelism with which the algorithm is executed.
By default this value is set to 4.
For more details on the concurrency settings and limitations please see Section 2.6.2, “CPU” of the System Requirements.
- relationshipTypes - String
- If the graph, on which the algorithm is run, was created with multiple relationship type projections, this parameter can be
used to select only a subset of the projected types.
The algorithm will then only consider relationships with the selected types.
- nodeWeightProperty - String
- In algorithms that support node weights this parameter defines the node property that contains the weights.
- relationshipWeightProperty - String
- In algorithms that support relationship weights this parameter defines the relationship property that contains the weights.
- maxIterations - Integer
- For iterative algorithms this parameter controls the maximum number of iterations.
- tolerance - Float
- Many iterative algorithms accept the tolerance parameter.
It controls the minimum delta between two iterations.
If the delta is less than the tolerance value, the algorithm is considered converged and stops.
- seedProperty - String
- Some algorithms can be calculated incrementally.
This means that results from a previous execution can be taken into account, even though the graph has changed.
seedProperty parameter defines the node property that contains the seed value.
Seeding can speed up computation and write times.
- writeProperty - String
write mode this parameter sets the name of the node or relationship property to which results are written.
If the property already exists, existing values will be overwritten.
- writeConcurrency - Integer
write mode this parameter controls the parallelism of write operations.
The Default is