Adjacency in LaTeX (u \sim v)

u∼vu \sim v
LaTeX command
u \sim v
Package
No package needed: built into LaTeX
Mode
Math mode only

Try Adjacency in a real LaTeX document

Open a ready-to-compile document that already uses u \sim v, with the right packages loaded. Edit it and see the PDF, no install needed.

Where it is used

Adjacency relation: u and v are joined by an edge in the graph.

\sim is a binary relation, so TeX places balanced thick spaces around it, making u \sim v read correctly. To specify the graph, write u \sim_G v. Some authors use u \leftrightarrow v or uv \in E(G) instead. Non-adjacency is written u \nsim v. Do not confuse \sim with \simeq (asymptotic or homotopy equivalence), \approx (approximately equal), or \backsim (reversed tilde). In probability, x \sim p means sampled from, so define adjacency explicitly in interdisciplinary papers. Neighborhoods follow naturally: N(v) = \{u : u \sim v\}.

Minimal compilable example

Paste this into an empty .tex file and compile it with pdfLaTeX, XeLaTeX or LuaLaTeX.

N(v)={u∈V(G):u∼v}N(v) = \{ u \in V(G) : u \sim v \}
\documentclass{article}
\begin{document}
Adjacency: $u \sim v$

\[ N(v) = \{ u \in V(G) : u \sim v \} \]
\end{document}

Related symbols

All نظرية البيان →

Frequently asked questions

How do I write Adjacency in LaTeX?
Type u \sim v in math mode, for example $N(v) = \{ u \in V(G) : u \sim v \}$. It works in plain LaTeX without loading any package.
Which package do I need for u \sim v?
None. u \sim v is part of standard LaTeX, so it compiles with nothing in the preamble but the document class.
Can I use u \sim v in text mode, or only in math mode?
Only in math mode. Outside $...$ LaTeX stops with "Missing $ inserted", so write $u \sim v$ in running text.
Math poweredاكتب LaTeX باستخدام الذكاء الاصطناعي

أفضل محرر LaTeX بالذكاء الاصطناعي، بديل Overleaf

يساعد Octree الباحثين من أكثر من 15 جامعة على كتابة أوراق البحث بشكل أسرع باستخدام الذكاء الاصطناعي

  • أنشئ رسوم TikZ جميلة باستخدام الذكاء الاصطناعي
  • ارفع صورة وحولها إلى LaTeX بسلاسة
  • احصل على مساعدة فورية في كتابة وتنسيق أوراق البحث