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


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:
Input undirected edges in a graph using TwoWayRule:
Related Guides
History
Text
Wolfram Research (2017), TwoWayRule, Wolfram Language function, https://reference.wolfram.com/language/ref/TwoWayRule.html.
CMS
Wolfram Language. 2017. "TwoWayRule." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/ref/TwoWayRule.html.
APA
Wolfram Language. (2017). TwoWayRule. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/TwoWayRule.html
BibTeX
@misc{reference.wolfram_2025_twowayrule, author="Wolfram Research", title="{TwoWayRule}", year="2017", howpublished="\url{https://reference.wolfram.com/language/ref/TwoWayRule.html}", note=[Accessed: 06-August-2025]}
BibLaTeX
@online{reference.wolfram_2025_twowayrule, organization={Wolfram Research}, title={TwoWayRule}, year={2017}, url={https://reference.wolfram.com/language/ref/TwoWayRule.html}, note=[Accessed: 06-August-2025]}