[Haskell-cafe] Right tree structure for complicated problem

Twan van Laarhoven twanvl at gmail.com
Sun Jan 22 01:17:11 CET 2012


On 2012-01-22 00:39, Pierre Penninckx wrote:
> So here is what I want to achieve:
> I'd like a program that calculates the time needed for water to flow out of a
> circuit made out of tube.
> The rules are :
> - There are multiple sources of water and only one exit.
> - The water can only take one path from a source to the exit.
> - Of course, a source of water contains a certain amount of water at the beginning.

Is this a maximum flow problem? If so, I would suggest using a standard 
algorithm to solve it. See wikipedia [1] for an explanation. The fgl library has 
a haskell implementation of such an algorithm [2].


Twan


[1] http://en.wikipedia.org/wiki/Maximum_flow_problem
[2] 
http://hackage.haskell.org/packages/archive/fgl/5.4.2.4/doc/html/Data-Graph-Inductive-Query-MaxFlow.html



More information about the Haskell-Cafe mailing list