I am looking for an answer and everything I tried so far is failing. This is my sample array displayed as an image:
But this array is pretty big and this one is just a scaled version of original one.
So I tried djikstra but it looks for perfect path and cannot work on such a big arrays. Each cluster is labeled and some of them ( too small ones are removed from display ).
I was wondering if BFS could do the job here, but I am not sure about this. Basically I need short path throught red cluster which goes from Top to the Bottom OR from Left to the Right, so only two clusters would get checked ( 1 and 12 ) since only they are connecting two sides. The path doesn't need to be perfect, I need to have reliable path at good speed for about 512x512 arrays.
Each connection has same weight with neighbours and that would be 1
Thanks for your time