A classical theorem by Hartshorne states that the dual graph of any arithmetically CohenMacaulay projective scheme is connected. We give a quantitative version of Hartshorne's result, in terms of Castelnuovo-Mumford regularity. If X ⊂ P n is an arithmetically Gorenstein projective scheme of regularity r + 1, and if every irreducible component of X has regularity ≤ r , we show that the dual graph of X is r+r −1 r -connected. The bound is sharp. We also provide a strong converse to Hartshorne's result: Every connected graph is the dual graph of a suitable arithmetically Cohen-Macaulay projective curve of regularity ≤ 3, whose components are all rational normal curves. The regularity bound is smallest possible in general.Further consequences of our work are: (1) Any graph is the Hochster-Huneke graph of a complete equidimensional local ring. (This answers a question by Sather-Wagstaff and Spiroff.) (2) The regularity of a curve is not larger than the sum of the regularities of its primary components.