Adjacency Matrix in LaTeX (A_{ij})

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

Try Adjacency Matrix in a real LaTeX document

Open a ready-to-compile document that already uses A_{ij}, with the right packages loaded. Edit it and see the PDF, no install needed.

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 poweredاكتب LaTeX باستخدام الذكاء الاصطناعي

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

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

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