Coordinate parallel transactions

A bookmark is a marker representing a state of the database. Bookmarks are useful when subsequent transactions in a cluster need to be coordinated, for example when you need to read data right after writing it.

When using the GDS client, any query following a call to gds.set_bookmarks() is not executed until the bookmarked transactions are propagated across the cluster.

Example of using bookmarks with GDS
# Use the `bookmarks` parameter to set any existing bookmarks, for example
# after running a query through the Neo4j driver. The default value is `None`.
gds = GraphDataScience(NEO4J_URI, auth=(NEO4J_USER, NEO4J_PASSWORD), bookmarks=None)

    CREATE (:Person {name: "Alice"})-[:KNOWS]->(:Person {name: "Bob"})

# Make sure the next queries will be executed after the CREATE query is fully propagated through the cluster

G, _ = gds.graph.project("myGraph", "Person", "KNOWS")

gds.pageRank.write(G, writeProperty="pagerank")

# Make sure the next queries will be executed after the pageRank scores were written back to the cluster

result = gds.run_cypher("MATCH (p:Person) RETURN, p.pagerank")


For more details about bookmarks, see the Neo4j Python driver.