This section describes the usage of transactions during the execution of an algorithm. When an algorithm procedure is called from Cypher, the procedure call is executed within the same transaction as the Cypher statement.
This section includes:
During loading, new transactions are used that do not inherit the transaction state of the Cypher transaction. This means that changes from the Cypher transaction state are not visible to the loading transactions.
For example, the following statement will not be able to load any nodes:
MATCH (n) SET n:MyLabel CALL algo.graph.load('graph-name', 'MyLabel', '')
Similarly, the following statement will execute the algorithm over an empty graph:
MATCH (n) SET n:MyLabel CALL algo.pageRank('MyLabel', null)
Properties are written to the graph in new transactions, batched over a fixed number of nodes. Those transactions are commited independently from the Cypher transaction. This means, if the Cypher transaction is terminated (either by the user or by the database system), already committed write transactions will not be rolled back.
The Cypher transaction can be terminated by either the user or the database system. This will eventually terminate all transactions that have been opened during loading, writing, or the algorithm execution. It is not immediately visible and can take a moment for the transactions to recognize that the Cypher transaction has been terminated.