Optimizing SVGs for pen plotting

Hi,
I am using rhino and grasshopper to export svg files which I take into inkscape to be plotted on my pen plotter.

I can’t figure out nearest neighbour. Some of the files generated from grasshopper that are iterative from hoopsnake seem to be plotted in order, but other files seem completely arbitrary, and take a long time to plot. I’ve tried sorting based on starting points and rebaking lines, but when exporting to svg it doesn’t seem to register the order.

Is there a way to optimize?

Layer could be a way to organize the order of drawing.