What exactly is "minimizing the ...
What exactly is "minimizing the number of disconnected stations"? If I have A,B,C,D,E,F, and connect A-B-C-D and E-F, do E and F still count as disconnected? That is, is the better solution to just not connect them, sparing one pipe? On the other hand, if "connected" means just "connected to some other station", then I can connect just A-B, C-D and E-F, sparing another pipe from B to C.