# Spatial Interaction (adjacency)

We recently looked at spatial interaction in the form of inverse distance weighting. However, some spatial interaction matrices are binary in nature (0,1), with 0 meaning the two geographic objects are not neighbors, and 1 meaning they are. A neighbor in this case could be an adjacent are (i.e. New York and Pennsylvania are neighbors, while New York and Virginia are not) or within a specified distance (i.e. with a specified distance of 100 miles, Rochester and Syracuse are neighbors, but Syracuse and Boston are not).

In our __example__, we have 6 New England States:

The SQL for creating the binary adjacency matrix is:

**TRANSFORM COUNT**(*)
**SELECT** [States].name
**FROM** [States], [States] **AS **[States2]
**WHERE Adjacent**(states.[Geom (I)],states2.[Geom (i)])
**GROUP BY** [States].[Name]
**PIVOT **[States2].[Name]

The only differences is that instead of computing the Min(Distance…), we are just obtaining the aggregate COUNT of the adjacent States by using the WHERE clause for spatial adjacency. This makes sense because Vermont for example is adjacent to New Hampshire and Massachusetts. But, the count of the number of times Vermot is adjacent to New Hampshire is just once – the same holds true for the other states.

The result is an adjacenty table like the following: