Guys, I could put this into the docs, just for future reference. Great contributions Marko and Alfredas! On Nov 18, 2011 11:58 PM, "Marko Rodriguez" <okramma...@gmail.com> wrote:
> > This seems to calculate the max flow (edges have "capacity"): > > > > source.outE.inV.loop(2){!it.object.equals(sink)}.paths.each{flow = > > it.capacity.min(); maxFlow += flow; > > it.findAll{it.capacity}.each{it.capacity -= flow}}; > > > > I can't believe this is so short! > > Thats the beauty of Gremlin. Once you "get it," you can rip some very > complex traversals in just a few characters. > > NOTES: For speed, make it.capacity -> it.getProperty('capacity') > Some good notes here: > https://github.com/tinkerpop/gremlin/wiki/Gremlin-Groovy-Path-Optimizations > > Glad we could help you with your problem. > > Enjoy!, > Marko. > > http://markorodriguez.com > > _______________________________________________ > Neo4j mailing list > User@lists.neo4j.org > https://lists.neo4j.org/mailman/listinfo/user > _______________________________________________ Neo4j mailing list User@lists.neo4j.org https://lists.neo4j.org/mailman/listinfo/user