added branch and bound implementation for more optimal connection