Adjacency Matrix in LaTeX (A_{ij})

AijA_{ij}
LaTeX command
A_{ij}
Package
No package needed: built into LaTeX
Mode
Math mode only

Where it is used

Entry in row i, column j of the adjacency matrix: 1 if vertices i and j are adjacent, 0 otherwise.

For a simple undirected graph the adjacency matrix is symmetric with zeros on the diagonal; in weighted graphs, A_{ij} holds the edge weight. A classic fact: (A^k)_{ij} counts walks of length k from i to j, so \operatorname{tr}(A^3)/6 is the number of triangles. Degrees are row sums, \deg(i) = \sum_j A_{ij}, and the Laplacian is L = D - A. Write A_{ij} with braces; A_ij would subscript only the i. For indices with commas, A_{i,j} is clearer when indices are expressions like A_{i+1,j}.

Minimal compilable example

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

(Ak)ij=#{walks of length k from i to j}(A^k)_{ij} = \#\{\text{walks of length } k \text{ from } i \text{ to } j\}
\documentclass{article}
\usepackage{amsmath}
\begin{document}
Adjacency Matrix: $A_{ij}$

\[ (A^k)_{ij} = \#\{\text{walks of length } k \text{ from } i \text{ to } j\} \]
\end{document}

Related symbols

All 그래프 이론 →

Frequently asked questions

How do I write Adjacency Matrix in LaTeX?
Type A_{ij} in math mode, for example $(A^k)_{ij} = \#\{\text{walks of length } k \text{ from } i \text{ to } j\}$. It works in plain LaTeX without loading any package.
Which package do I need for A_{ij}?
None. A_{ij} is part of standard LaTeX, so it compiles with nothing in the preamble but the document class.
Can I use A_{ij} in text mode, or only in math mode?
Only in math mode. Outside $...$ LaTeX stops with "Missing $ inserted", so write $A_{ij}$ in running text.
Math poweredAI로 LaTeX 작성

최고의 AI LaTeX 편집기, Overleaf 대안

Octree는 15개 이상의 대학의 연구자들이 AI를 사용하여 논문을 더 빠르게 작성하도록 도움

  • AI로 아름다운 TikZ 다이어그램 생성
  • 이미지를 업로드하고 LaTeX로 원활하게 변환
  • 논문 작성 및 서식에 대한 즉각적인 지원 받기