2.5. Transaction Handling

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 is documentation for the Graph Algorithms Library, which has been deprecated by the Graph Data Science Library (GDS).

This section includes:

2.5.1. During graph loading

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:

SET n:MyLabel
CALL algo.pageRank('MyLabel', null)

2.5.2. During graph writing

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.

2.5.3. Transaction termination

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.