On a large scale, the universe expansion pulls galaxies apart while gravity keeps galaxies from expanding. So there seems to be a certain scale, at which the expansion and gravity roughly cancel each other. Within a galaxy gravity wins, but remote galaxies fly apart.
What happens if galaxies are close to each other? I know Andromeda is not a good example, as it is already on a collision course with Milky Way, but generally, do neighboring galaxies of the same group tend to be kept together by gravity or do they fly apart with the expansion of the universe? At what scale does the expansion finally overcome gravity?