24

I gone through many pages using Google, but not understand exact meaning of Strict-weak Ordering term.

I have this requirement while sorting strings.

  • Your question was put on hold, the message above (and possibly comments) should give an explanation why. (In particular, this link might be useful.) You might try to edit your question to address these issues. Note that the next edit puts your post in the review queue, where users can vote whether to reopen it or leave it closed. (Therefore it would be good to avoid minor edits and improve your question as much as possible with the next edit.) – Martin Sleziak Jul 26 '17 at 09:18
  • 1
    This should help : https://stackoverflow.com/questions/979759/operator-and-strict-weak-ordering – DollarAkshay Jul 13 '19 at 21:56

2 Answers2

24

This notion, which sounds somewhat like an oxymoron, is not very commonly used in mathematics, but it is in programming. The "strict" just means it is the irreflexive form "$<$" of the comparison rather than the reflexive "$\leq$". The "weak" means that the absence of both $a<b$ and $b<a$ do not imply that $a=b$. However as explained here, the relation that neither $a<b$ nor $b<a$ holds is required to be an equivalence relation. The strict weak ordering then induces a (strict) total ordering on the equivalence classes for this equivalence relation.

This notion is typically used for relations that are in basically total orderings, but defined using only partial information about the identity of items. For instance if $a<b$ between persons means that $a$ has a name that (strictly) precedes the name of $b$ alphabetically, then this defines a strict weak order, since different persons may have identical names; the relation of having identical names is an equivalence relation.

One can easily show that for a strict weak ordering "$<$", the relation $a\not<b$ is (reflexive and) transitive, so it is a pre-order, and the associated equivalence relation is the same as the one associated above to the strict weak ordering. In fact "$a\not<b$" is a total pre-order which induces the same total ordering (or maybe it is better to say the opposite ordering, in view of the negation) on its equivalence classes as the strict weak ordering does. I think I just explained that the notions of strict weak ordering and total pre-order are equivalent. The WP article also does a reasonable job explaining this.

Trent Gm
  • 103
  • So in simple words can I say, if I want to compare two strings, then strings can be either a<b or b<a but cannot be a=b. – Pranit Kothari Nov 29 '13 at 09:42
  • 2
    If you are comparing strings, then you would often just define a total ordering (which is a special case of a strict weak ordering) like lexicographic ordering. However, it could be that you want to ignore upper case/lower case distinctions, which would make it into a true weak ordering (strings differing only by case distinctions would then form an equivalence class). – Marc van Leeuwen Nov 29 '13 at 10:11
  • 1
    @pranitkothari: As for your comment, I don't quite understand it. The ordering as asked whether $a<b$, and it may answer "yes" or "no". The ordering relation never says "$a=b$", all that it can express is that neither $a<b$ nor $b<a$ hold. – Marc van Leeuwen Nov 29 '13 at 10:14
  • @MarcvanLeeuwen Thank you, particularly for the comment. It made me understand what an equivalence class and better understand about strict weak ordering. – legends2k Feb 01 '16 at 09:29
  • 2
    Definitely not layman's terms – DollarAkshay Jul 13 '19 at 21:53
1

In layman's terms, a strict weak ordering is a strict total ordering (e.g. < on numbers) of some aspect of its operands. So for example, relations that order people by their age and colors by their luminance are strict-weak.

The analysis that led me to this conclusion is here.

  • 1
    Your answer could be improved with additional supporting information. Please [edit] to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers in the help center. – CrSb0001 Sep 25 '23 at 19:42
  • @CrSb0001 I was trying to avoid overwhelming the reader with details, since the OP asked for “laymanʻs terms;” do you feel the link to my 13-year-old article is sufficient support? – Dave Abrahams Sep 26 '23 at 18:06