TwoWayRule

x<->y or xy

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

Details

  • 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.

Examples

Basic Examples  (2)

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

In[1]:=
Click for copyable input
Out[1]=

Input undirected edges in a graph using TwoWayRule:

In[1]:=
Click for copyable input
Out[1]=

See Also

Rule  UndirectedEdge  Cycles  Equal  Equivalent  Graph  Transpose

Introduced in 2017
(11.2)