init2
IsConnected algorithm