I have many such matrices(whose dimension are all 3*3.) like:
list1={{0,3,0},{4,1,2},{0,5,0}};
list2={{0,6,0},{1,2,8},{0,7,0}};
list3={{0,1,0},{9,5,7},{0,11,0}};
list4={{0,2,0},{5,7,10},{0,12,0}};
Their corners is all $0$.I show they with two dimension format.
As you can see they have some repeated elements(Just can have two repeated elements between two matrices).I want to combine it in this order$ \left(\begin{matrix} list1&list2\\list3&list4 \end{matrix} \right) $.in this case,that is: $$\left( \begin{array}{cccc} 0 & 3 & 6 & 0 \\ 4 & 1 & 2 & 8 \\ 9 & 5 & 7 & 10 \\ 0 & 11 & 12 & 0 \\ \end{array} \right)$$ In this simple case,we can know its order should be $ \left(\begin{matrix} list1&list2\\list3&list4 \end{matrix} \right) $ after a glance.But in the real case,I just know their neighbouring relations like
{canBeConnect[list1,list2],canBeConnect[list1,list3],
canBeConnect[list3,list4],canBeConnect[list2,list4]}
Any elegant method can do this?
Image[]
and use this answer to find the matching edges. $\endgroup$