sorting-network
sorting-network copied to clipboard
Layers/depth seem non-optimal
While plotting a machine generated network I noticed that the order of nodes matters (for the layer assignment) while it should not AFAICT.
For example 2:5,0:1,4:5,0:3 yields:
While 2:5,4:5,0:1,0:3 yields:
and I expected it to be the same as the previous one since the layers and dephts did not change.
Q: is this a bug or a feature?
Yes, this is a bug.
It needs some code to "collapse" the network so that there are no unnecessary gaps at any given depth.
@henkjan-sneller Thanks for reporting this. It should be fixed by a change I just made.
Thanx!
The optimal depth grouping has been fixed, but it seems within a single depth, the comparators are still not organized as well as they could be.
So maybe there is still some work that can be done to improve this.