Question

I have a graph on neo4j and I would like to run a topological sort, preferably without writing on the graph itself (to allow for multiple clients to run algorithms on the same graph simultaneously).

How should I approach this? Shall I clone the graph and work on the temporary copy, or is there a sort of traversal/iterator ?

thanks

PS: I'm using neo4J through the neography gem (REST API) on Ruby

Was it helpful?

Solution

Dan,

You can start a transaction and fail it once you have the data you need so it won't write to the database. See http://maxdemarzi.com/2012/02/21/max-flow-with-gremlin-and-transactions/ for an example. This won't work too well if you have to touch a million nodes, but for small subsets of the graph it should be no problem.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top