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

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 Teori Graf →

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 poweredTulis LaTeX menggunakan AI

Editor LaTeX AI Terbaik, Alternatif Overleaf

Octree membantu peneliti dari 15+ universitas menulis makalah penelitian lebih cepat menggunakan AI

  • Hasilkan diagram TikZ yang indah menggunakan AI
  • Unggah gambar dan konversi ke LaTeX dengan mulus
  • Dapatkan bantuan instan untuk menulis dan memformat makalah penelitian