I tried using DFS(the only search I learnt). But its flawed because it will constantly be looking into one path till it finds a connection and this not connect the right pat