Spatial structure and social structure