Skip to main content

What does "adjacency" of vertices in a graph mean?

Adjacency of vertices means that two vertices are connected by an edge.

If there is an edge between vertices A and B, then:

  • In an undirected graph - A and B are adjacent (A ↔ B).
  • In a directed graph - • if there is an edge A → B, then B is adjacent to A in the direction from A to B, • but not necessarily the other way around.

Examples:

  • In a social network: if two users are "friends", their vertices are adjacent.
  • On a route: if there is a road between cities, the cities are adjacent.

Adjacent vertices are often stored in an adjacency list - each vertex has a record of all the vertices it is connected to.


Summary: adjacency is a sign of a direct connection: vertices are considered adjacent if there is an edge between them.

Short Answer

Interview ready
Premium

A concise answer to help you respond confidently on this topic during an interview.