Change individual curve lengths in a network

I have a network of curves as shown in the image below. They are all individual curves, and for each of them I have a value of the length I want them to be. I am looking for a way to change the length of each curve to the desired size, whilst keeping the curves connected. If needed, I also have a connectivity matrix between each vertex ‘describing’ the lines.

image