Identifying neighboring edges of subsquares using Python

34 Views Asked by At

I have 12 edges, marked from 0 to 11. There are 4 squares marked in red from 0 to 3. How do I identify the neighboring edges of each square?

For example, square 0 has edges [0,2,3,5], square 1 has edges [1,3,4,6] and so on.

enter image description here