Jean-Claude Wippler wrote:

Does anyone know how to do a multi-column sort, using column-wise permutations?

Is this the right approach? Thinking out loud here.


A multi-column sort is really a precedence sort. You only need to sort on a secondary or tertiary key if the primary key has equivalent values.

1) sort on next property
2) if any more properties groupby property else goto 4
3) foreach groupby subview go to 1
4) reassemble final indices

Result -> stable sort, I think :)


Hopefully I'm being clear. Here is a stupid diagram in the form of a tree structure:


view -> column1 -> groupby -> column 2 -> groupby -> sort -> Final indices
sort column1 sort on subview
A subview -> 1 2
B subview -> 7
8
This seems to be less work overall and might utilize metakit's tech a little better.


I have a half-baked python implementation that requires an index column (mainly because the groupby method doesn't keep track of the row index)

The best-time complexity should be less as well as the size of the sorts should decrease the further down the tree you go.

Brian

_____________________________________________
Metakit mailing list  -  [EMAIL PROTECTED]
http://www.equi4.com/mailman/listinfo/metakit

Reply via email to