Back to Academy
graphs
Connected Components
Connected Components identifies all groups of vertices in an undirected graph where every vertex is reachable from every other vertex in the same group. It uses DFS or BFS to traverse each unvisited vertex, marking all reachable nodes as part of the same component. This is fundamental for understanding graph structure and connectivity.
Use Cases
- •Social network analysis to find friend clusters
- •Image processing for identifying distinct regions
- •Network reliability analysis to detect isolated subnetworks
Complexity Analysis
| Metric | Best | Average | Worst |
|---|---|---|---|
| Time | O(V + E) | O(V + E) | O(V + E) |
| Space | O(V) | ||
Visualization
Implementation
Output
Click "Run Code" to see output...