Not exactly: The aim is not to know which path must the water take to the least time.<br><br>The fact is, the water can only take one path, due to the circuit configuration, from the source to the exit, so there is no choice for the water.<br>

It&#39;s not a graph with multiple paths, it&#39;s a tree with leafs as water sources and branches as tubes.<br><br>So the aim is to know what time, with this circuit configuration, will the water take to exit.<br>Plus, the sources of water are finite.<br>

<br>But, I can maybe inspirate myself from the maximum flow problem.<br>I&#39;ll take a look, but it&#39;s not really the same problem (although the algorithm could be the same).<br><br>Thanks !<br>Ibiz<br><br><div class="gmail_quote">

2012/1/22 Twan van Laarhoven <span dir="ltr">&lt;<a href="mailto:twanvl@gmail.com">twanvl@gmail.com</a>&gt;</span><br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div class="im">
On <a href="tel:2012-01-22%2000" value="+12012012200" target="_blank">2012-01-22 00</a>:39, Pierre Penninckx wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
So here is what I want to achieve:<br>
I&#39;d like a program that calculates the time needed for water to flow out of a<br>
circuit made out of tube.<br>
The rules are :<br>
- There are multiple sources of water and only one exit.<br>
- The water can only take one path from a source to the exit.<br>
- Of course, a source of water contains a certain amount of water at the beginning.<br>
</blockquote>
<br></div>
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].<br>
<br>
<br>
Twan<br>
<br>
<br>
[1] <a href="http://en.wikipedia.org/wiki/Maximum_flow_problem" target="_blank">http://en.wikipedia.org/wiki/<u></u>Maximum_flow_problem</a><br>
[2] <a href="http://hackage.haskell.org/packages/archive/fgl/5.4.2.4/doc/html/Data-Graph-Inductive-Query-MaxFlow.html" target="_blank">http://hackage.haskell.org/<u></u>packages/archive/fgl/5.4.2.4/<u></u>doc/html/Data-Graph-Inductive-<u></u>Query-MaxFlow.html</a><br>


<br>
______________________________<u></u>_________________<br>
Haskell-Cafe mailing list<br>
<a href="mailto:Haskell-Cafe@haskell.org" target="_blank">Haskell-Cafe@haskell.org</a><br>
<a href="http://www.haskell.org/mailman/listinfo/haskell-cafe" target="_blank">http://www.haskell.org/<u></u>mailman/listinfo/haskell-cafe</a><br>
</blockquote></div><br>