x<->y or xy

represents a two-way rule expressing exchange or correspondence of x and y.


  • Two-way rules are very general constructs that can represent exchange, equivalence, correspondence and other bidirectional relations between expressions.
  • The character can be entered as [TwoWayRule].
  • In StandardForm, TwoWayRule is printed using .
  • Transpose[array,nm] transposes levels n and m of the array, without changing other levels.
  • TwoWayRule[a,b] is equivalent to UndirectedEdge[a,b] in Graph constructors.


Basic Examples  (2)

Exchange levels 2 and 3 of an array of depth 3 using TwoWayRule to express a permutation:

Input undirected edges in a graph using TwoWayRule:

Introduced in 2017