Permalink
Browse files

using transactions in order to repeat the process

  • Loading branch information...
1 parent fa00673 commit f5a578a9eaf87d68782e991a180d523d8411f5e7 @maxdemarzi committed Feb 16, 2012
Showing with 5 additions and 2 deletions.
  1. +5 −2 neoflow.rb
View
7 neoflow.rb
@@ -32,10 +32,12 @@ def create_graph
def max_flow
neo = Neography::Rest.new
- neo.execute_script("source = g.idx('states_index')[[name:'California']];
- sink = g.idx('states_index')[[name:'Illinois']];
+ neo.execute_script("source = g.idx('states_index')[[name:'California']].iterator().next();
+ sink = g.idx('states_index')[[name:'Illinois']].iterator().next();
max_flow = 0;
+ g.setMaxBufferSize(0);
+ g.startTransaction();
source.outE.inV.loop(2){
!it.object.equals(sink)}.
@@ -46,6 +48,7 @@ def max_flow
it.capacity}.each{
it.capacity -= flow}
};
+ g.stopTransaction(TransactionalGraph.Conclusion.FAILURE);
max_flow;")
end

0 comments on commit f5a578a

Please sign in to comment.