Interview concept

What is a graph in interviews?

A graph is a set of nodes connected by edges, which may be directed or weighted. Graph problems cover traversal, shortest paths, connectivity, and ordering, and appear across coding and system design rounds.

Interview concept

How it works

Representations

Adjacency lists suit sparse graphs; adjacency matrices suit dense graphs or fast edge lookups.

Core algorithms

BFS and DFS for traversal, Dijkstra for weighted shortest paths, and topological sort for ordering.

Interview uses

Dependency resolution, social networks, maps, and scheduling map naturally to graphs.

Interview concept

Responsible use

Use any live AI assistant only where interview, workplace, school, and platform rules allow it. Do not use generated answers to misrepresent your skills, experience, or authorship.

FAQ

Common questions.

How do I represent a graph in an interview?

Use an adjacency list for most problems; choose an adjacency matrix when the graph is dense or you need O(1) edge checks.

Which algorithms should I know?

Know BFS, DFS, topological sort, union-find, and Dijkstra for weighted shortest paths.