I don't think cosmologist's have all the answers yet. Because of the density variation across the universe some areas are bound to have more gravity. These areas of more gravity would pull galaxies and dark matter towards them despite the general expansion of the universe. That too would account for the charecteristic structure of the Universe