What if the spacing means the end points can't be included? For example, if we want vertices spread over every 4 units in a 10 unit line, this isn't possible:
But anyway I think you could use polar notation to solve this. Convert the vertex near the number 1 to an r theta offset from the neighbouring node, then where n=the number of points desired, divide r by n-1 and that gives you the distance between each point, then use that to calculate the r theta position of each new vertex and convert each back to rectangular to get the x,y positions.
So let's say for example vertex 1 is at r theta = 12 at 45 degrees, the neighbouring node is at (0,0), and we want 4 points. 12/3=4 so the new vertices will be at r=0, 4, 8 and 12; theta will be the same for all, so just convert (0,45), (4,45), (8,45) and (12,45) back to rectangular coords and that will be the solution.
But if you know the spacing then the division isn't necessary; you still need theta so the r-p and p-r conversions are still both needed, but if vertex 1 isn't at an r that is evenly divisible by the spacing then you have the previously mentioned problem, what if, say, vertex 1 is at (11,45) and the spacing of 4 is requested? Would you then place the next vertex at r=1 for the next segment, i.e.:
N--------V--------V---.. // Original lines. V=vertex, N=node
N---x---xP--x---x-P-x-.. // New lines with x at the new vertices. What happens at P?