ArticleslgStudy

mathematics

Adjacency matrix

Adjacency matrix is a mathematics topic covered in the lgStudy science library. This page brings together a partial reference excerpt, illustrations, worked examples, real-world applications and a short study plan, so you can understand Adjacency matrix rather than just read about it. In short: In graph theory and computer science, an adjacency matrix is a square matrix used to represent a finite graph. The elements of the matrix indicate whether pairs of vertices are adjacent or not within the graph.

Adjacency matrix — main illustration
Adjacency matrix — illustration

Key takeaways

  • Adjacency matrix belongs to mathematics; place it in that map before memorising details.
  • Learn the definition first, then one example that makes the definition concrete.
  • Connect Adjacency matrix to a quantity you can measure, compute or draw — that is where exam questions come from.
  • Reproduce the core statement of Adjacency matrix from memory before moving on to harder problems.

Reference excerpt

In graph theory and computer science, an adjacency matrix is a square matrix used to represent a finite graph. The elements of the matrix indicate whether pairs of vertices are adjacent or not within the graph. In the special case of a finite simple graph, the adjacency matrix is a (0,1)-matrix with zeros on its diagonal. If the graph is undirected (i.e. all of its edges are bidirectional), the adjacency matrix is symmetric. The relationship between a graph and the eigenvalues and eigenvectors of its adjacency matrix is studied in spectral graph theory. The adjacency matrix of a graph should be distinguished from its incidence matrix, a different matrix representation whose elements indicate whether vertex–edge pairs are incident or not, and its degree matrix, which contains information about the degree of each vertex.

Definition For a simple graph with vertex set U = {u1, ..., un}, the adjacency matrix is a square n × n matrix A such that its element Aij is 1 when there is an edge from vertex ui to vertex uj, and 0 when there is no edge. The diagonal elements of the matrix are all 0, since edges from a vertex to itself (loops) are not allowed in simple graphs. It is also sometimes useful in algebraic graph theory to replace the nonzero elements with algebraic variables. The same concept can be extended to multigraphs and graphs with loops by storing the number of edges between each two vertices in the corresponding matrix element, and by allowing nonzero diagonal elements. Loops may be counted either once (as a single edge) or twice (as two vertex-edge incidences), as long as a consistent convention is followed. Undirected graphs often use the latter convention of counting loops twice, whereas directed graphs typically use the former convention.

Of a bipartite graph The adjacency matrix A of a bipartite graph whose two parts have r and s vertices can be written in the form

A=(0r,rBB𝖳0s,s), where B is an r × s matrix, and 0r,r and 0s,s represent the r × r and s × s zero matrices. In this case, the smaller matrix B uniquely represents the graph, and the remaining parts of A can be discarded as redundant. B is sometimes called the biadjacency matrix. Formally, let G = (U, V, E) be a bipartite graph with parts U = {u1, ..., ur}, V = {v1, ..., vs} and edges E. The biadjacency matrix is the r × s 0–1 matrix B in which bi,j = 1 if and only if (ui, vj) ∈ E. If G is a bipartite multigraph or weighted graph, then the elements bi,j are taken to be the number of edges between the vertices or the weight of the edge (ui, vj), respectively.

Variations An (a, b, c)-adjacency matrix A of a simple graph has Ai,j = a if (i, j) is an edge, b if it is not, and c on the diagonal. The Seidel adjacency matrix is a (−1, 1, 0)-adjacency matrix. This matrix is used in studying strongly regular graphs and two-graphs. The distance matrix has in position (i, j) the distance between vertices vi and vj. The distance is the length of a shortest path connecting the vertices. Unless lengths of edges are explicitly provided, the length of a path is the number of edges in it. The distance matrix resembles a high power of the adjacency matrix, but instead of telling only whether or not two vertices are connected (i.e., the connection matrix, which contains Boolean values), it gives the exact distance between them.

Examples

Trivial graphs The adjacency matrix of an empty graph is a zero matrix. The adjacency matrix of a complete graph contains all ones except along the diagonal where there are only zeros.

Undirected graphs The convention followed here (for undirected graphs) is that each edge adds 1 to the appropriate cell in the matrix, and each loop (an edge from a vertex to itself) adds 2 to the appropriate cell on the diagonal in the matrix. This allows the degree of a vertex to be easily found by taking the sum of the values in either its respective row or column in the adjacency matrix.

Directed graphs The adjacency matrix of a directed graph can be asymmetric. One can define the adjacency matrix of a directed graph either such that

a non-zero element Aij indicates an edge from i to j or it indicates an edge from j to i. The former definition is commonly used in graph theory and social network analysis (e.g., sociology, political science, economics, psychology). The latter is more common in other applied sciences (e.g., dynamical systems, physics, network science) where A is sometimes used to describe linear dynamics on graphs. Using the first definition, the in-degrees of a vertex can be computed by summing the entries of the corresponding column and the out-degree of vertex by summing the entries of the corresponding row. When using the second definition, the in-degree of a vertex is given by the corresponding row sum and the out-degree is given by the corresponding column sum.

Properties

Spectrum The adjacency matrix of an undirected simple graph is symmetric, and therefore has a complete set of real eigenvalues and an orthogonal eigenvector basis. The set of eigenvalues of a graph is the spectrum of the graph. It is common to denote the eigenvalues by λ1≥λ2≥⋯≥λn. The greatest eigenvalue λ1 is bounded above by the maximum degree. This can be seen as result of the Perron–Frobenius theorem, but it can be proved easily. Let v be one eigenvector associated to λ1 and x an entry in which v has maximum absolute value. Without loss of generality assume vx is positive since otherwise you simply take the eigenvector −v, also associated to λ1. Then

λ1vx=(Av)x=∑y=1nAx,yvy≤∑y=1nAx,yvx=vxdeg⁡(x). For d-regular graphs, d is the first eigenvalue of A for the vector v = (1, ..., 1) (it is easy to check that it is an eigenvalue and it is the maximum because of the above bound). The multiplicity of this eigenvalue is the number of connected components of G, in particular λ1>λ2 for connected graphs. It can be shown that for each eigenvalue λi, its opposite −λi=λn+1−i is also an eigenvalue of A if G is a bipartite graph. In particular −d is an eigenvalue of any d-regular bipartite graph. The difference λ1−λ2 is called the spectral gap and it is related to the expansion of G. It is also useful to introduce the spectral radius of A denoted by λ(G)=max|λi|<d|λi|. This number is bounded by λ(G)≥2d−1−o(1). This bound is tight in the Ramanujan graphs.

… excerpt ends here. Continue reading the full article.

Illustrations

Adjacency matrix illustration
Adjacency matrix illustration
Adjacency matrix illustration
Adjacency matrix illustration

Worked examples

Example 1 — a first encounter with Adjacency matrix

Start with the simplest possible case. Write down what Adjacency matrix claims or describes in one sentence, then invent the smallest concrete situation in which that sentence is true. In mathematics, the smallest case is usually a single object, a single equation or a single measurement. Check that every symbol or term in your sentence has a meaning in that case.

Example 2 — changing one variable

Take the situation from Example 1 and change exactly one quantity: double it, halve it, or set it to zero. Predict what should happen to Adjacency matrix before you calculate. Comparing your prediction with the result is the fastest way to find out whether you understand the idea or only the words.

Example 3 — an exam-style question

Typical questions about Adjacency matrix ask you to (a) state it precisely, (b) apply it to given data, and (c) explain a limitation. Practise writing all three answers in under five minutes; the third part is what separates a full-mark answer from an average one.

Applications of Adjacency matrix

In research
Adjacency matrix appears in mathematics research whenever the underlying quantities have to be modelled precisely. Papers usually cite it as a starting assumption and then explore where it breaks down.
In technology and industry
Engineering practice reuses Adjacency matrix in design rules, simulations and safety margins. Knowing the idea lets you read a specification sheet and understand why the numbers look the way they do.
In the classroom
Adjacency matrix is common in secondary-school and first-year university syllabi. It links to neighbouring topics Algebraic graph theory, Graph data structures, Matrices (mathematics), so understanding it makes those chapters shorter.
In everyday life
Look for Adjacency matrix outside the textbook — in sport, cooking, traffic, electronics or the sky above you. An example you found yourself is remembered far longer than one you were given.
Ask Teacher Smith questions about this articleOpens your AI tutor with a question about “Adjacency matrix” →

How to study Adjacency matrix in 20 minutes

  1. Read the reference excerpt below once, without taking notes.
  2. Close the page and write down what Adjacency matrix means in your own words.
  3. Compare your version with the excerpt and mark what you missed.
  4. Work through the three examples above with pen and paper.
  5. Explain Adjacency matrix out loud to somebody else — or to Teacher Smith in the lgStudy chat.

Frequently asked questions

What is Adjacency matrix in simple terms?

In graph theory and computer science, an adjacency matrix is a square matrix used to represent a finite graph. The elements of the matrix indicate whether pairs of vertices are adjacent or not within the graph.

Why does Adjacency matrix matter?

Because it connects several mathematics ideas at once: it gives you a definition you can apply, a quantity you can calculate, and a way to check whether a result is plausible.

How should I study Adjacency matrix?

Read the excerpt, restate it from memory, then work through the examples and applications listed on this page. The five-step study plan above takes about twenty minutes.

What does this page cover?

It gives you a compact reference excerpt plus original lgStudy explanations, examples, applications and study material on Adjacency matrix.

Tags

  • Algebraic graph theory
  • Graph data structures
  • Matrices (mathematics)

Keep exploring