Mathwords logoMathwords

Adjacent Vertices — Definition, Formula & Examples

Adjacent vertices are two vertices (nodes) in a graph that are directly connected by an edge. If you can travel from one vertex to the other along a single edge, those vertices are adjacent.

In a graph G=(V,E)G = (V, E), two vertices uu and vv are adjacent if and only if there exists an edge eEe \in E such that e={u,v}e = \{u, v\}. Adjacency is a symmetric relation in undirected graphs: if uu is adjacent to vv, then vv is adjacent to uu.

How It Works

To determine whether two vertices are adjacent, check whether an edge directly connects them. You do not follow a path through other vertices — only a single edge counts. In an adjacency matrix, vertices viv_i and vjv_j are adjacent when the entry in row ii, column jj equals 1. The set of all vertices adjacent to a given vertex vv is called the neighborhood of vv, often written N(v)N(v). The number of vertices adjacent to vv equals the degree of vv.

Worked Example

Problem: A graph has vertices {A,B,C,D}\{A, B, C, D\} and edges {A,B}\{A, B\}, {B,C}\{B, C\}, {B,D}\{B, D\}, and {C,D}\{C, D\}. Which vertices are adjacent to BB? Are AA and DD adjacent?
Find edges containing B: Look at every edge that includes vertex BB.
{A,B}, {B,C}, {B,D}\{A, B\},\ \{B, C\},\ \{B, D\}
List adjacent vertices of B: The other endpoint of each edge gives a vertex adjacent to BB.
N(B)={A,C,D}N(B) = \{A, C, D\}
Check A and D: Look for an edge {A,D}\{A, D\} in the edge set. No such edge exists, so AA and DD are not adjacent.
Answer: BB is adjacent to AA, CC, and DD (so deg(B)=3\deg(B) = 3). Vertices AA and DD are not adjacent because no edge connects them directly.

Why It Matters

Adjacency is the most basic relationship in graph theory and drives algorithms you encounter in computer science courses, such as breadth-first search and Dijkstra's shortest-path algorithm. Social networks, road maps, and circuit diagrams all rely on knowing which nodes connect directly to which others.

Common Mistakes

Mistake: Calling two vertices adjacent when they are connected by a path but not by a single edge.
Correction: Adjacency requires a direct edge between the two vertices. Being reachable through intermediate vertices does not make two vertices adjacent.