I have the task to connect 6 input sources of fluid with 9 output (sinks) sources. Each input should be connected to each output. Each input should be able to distribute the fluid to only 1 output at a time. I have straight pipes, Y connections and valves, that I can use. I should use the MINIMUM amount of valves and Y connections as possible.

Is there a standard approach to reducing the number of components required for a design like this?

This is the best I could get to so far: enter image description here

  • $\begingroup$ Do you have T connections? $\endgroup$ – Chris Mueller Jun 16 '15 at 12:19
  • $\begingroup$ No.I have only Y connections, valves and straight pipes. $\endgroup$ – Trenera Jun 16 '15 at 12:22
  • $\begingroup$ Is there a difference between a Y connection and a T connection in this case? $\endgroup$ – Ethan48 Jun 16 '15 at 14:43
  • $\begingroup$ I don't think so, but the task says Y connection... $\endgroup$ – Trenera Jun 16 '15 at 14:45

As mentioned in the comments, I think it is possible to do it with 15 valves (1 per inlet and 1 per outlet) and 13 Y connections as shown below:

enter image description here


I recommend approaching problems like this by starting with a base case and working up from there until you see a pattern.

For piping, the base case is a straight case with one input flowing to one output. Depending on the exact specs of the problem, this requires either 0 or 1 valves; it does not require any branching.

I------O   (or, I--▷◁--O)

Add an input to the base case:


Add an output to the base case:


Add both an input and an output to the base case:

         /     \
I--▷◁--+       +--▷◁--O

Here's a nicer-looking diagram, if you prefer.

What you can see from looking at these simple cases is that:

  • A single input or output requires no valves.
  • If there is more than one input or output, each requires one valve.
  • Each input or output beyond the first requires one branch.

Since your problem has multiple inputs and multiple outputs, the minimum number of valves is equal to the total number of inputs and outputs and the minimum number of branches is equal to two fewer than the total number of inputs and outputs.

  • 1
    $\begingroup$ This correlates with my answer of 15 valves and 13 Y connections. $\endgroup$ – am304 Jun 16 '15 at 18:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.