sorting-network
sorting-network copied to clipboard
SVG generation could be improved for a Batcher odd-even network with n = 16
First of all, thanks for the very useful script.
Consider the following input, corresponding to a Batcher odd-even sorting network with n = 16:
0:1,2:3,4:5,6:7,8:9,10:11,12:13,14:15
0:2,1:3,4:6,5:7,8:10,9:11,12:14,13:15
1:2,5:6,9:10,13:14
0:4,1:5,2:6,3:7,8:12,9:13,10:14,11:15
2:4,3:5,10:12,11:13
1:2,3:4,5:6,9:10,11:12,13:14
0:8,1:9,2:10,3:11,4:12,5:13,6:14,7:15
4:8,5:9,6:10,7:11
2:4,3:5,6:8,7:9,10:12,11:13
1:2,3:4,5:6,7:8,9:10,11:12,13:14
This is an example representation found in the web:
However, what is actually generated is this:
For instance, the 3:7 and 11:15 pairs from the fourth line of the input above could be laid out better (IMO it should be moved to the right of the 2:6 and 10:14 pairs), and similarly for the 0:8 and 7:15 pairs in line 7 of the input above -- they could be moved together with the other pairs in that line.