Understanding the connected component pattern


A connected component in a graph is a subgraph where there is a path between every pair of nodes. Connected components are usually used in the context of undirected graphs only. Directed graphs have more complex connectivity due to unidirectional edges, and such subgraphs where there is a path between every pair of nodes are called strongly connected components. We will only learn about connected components in undirected graphs in this lesson. Some graph problems require us to find all and process all the connected components and the nodes in them in an undirected graph. We can solve such problems efficiently using the connected component technique.

The connected component pattern is a classification of problems on undirected graphs that can be solved using the connected component technique.
Loading Image

An undirected graph with three connected components.

Liking the course? Check our discounted plans to continue learning.