Unordered pair (source code)

= Unordered pair

An <unordered pair> $\{a,b\}$ is a <set> containing the specified elements, with no distinction between first and second positions. Hence $\{a,b\}=\{b,a\}$. If $a=b$, the notation denotes the <singleton> $\{a\}$, rather than a two-element <set>.

For distinct $a,b$, an <unordered pair> represents an <edge> in a simple undirected <graph>. An <ordered pair> instead represents a directed edge because reversing its entries changes the direction. If multiplicity must be retained even for equal elements, a <multiset> is needed instead of a <set>.