A compression wave passing through an elastic medium propagates longitudinally—along the direction in which the particles oscillate. One example is a primary wave (or P-wave) that occurs in an earthquake.
In the model, each red point represents an atom moving around its equilibrium position (the middle blue point). Assuming the forces between atoms are like springs implies that the atoms move like harmonic oscillators (arrows and circles at the top of the figure). The magenta arrows indicate the locations of rarefaction and compression phases.