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. Existing bookmarks can also be provided when constructing the GraphDataScience object, via its bookmarks parameter, for example to continue from a query run through the Neo4j driver in a previous session.

Example of using bookmarks with GDS
gds.run_cypher("""
    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
gds.set_bookmarks(gds.last_bookmarks())

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

gds.page_rank.write(G, write_property="pagerank")

# Make sure the next queries will be executed after the pageRank scores were written back to the cluster
gds.set_bookmarks(gds.last_bookmarks())

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

G.drop()

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