The Top and Bottom values are the same, and the Right value = Left value of the adjacent tile. (You may want a buffer of a pixel or two when calculating).
The algorithm is simply, pick the tile to compare, and cycle through every other tile to see if it's Top and Right equal the Top and Left of the other tile. If so, they are adjacent (on the right). You can do the opposite to check the left-side.