Dynamic Lines

I wasn’t sure how to name this one but here’s my question,
how can I make it so the user can click on boxes and drag them and have lines connecting the boxes that adjust while you drag, Ive got the boxes to drag so far,
Are there any tutorials with draging and gravity or something like that. because I need the boxes to react like there on an elastic when you let go.

Sorry that this was so confusing to read.