Article Categories
- All Categories
-
Data Structure
-
Networking
-
RDBMS
-
Operating System
-
Java
-
MS Excel
-
iOS
-
HTML
-
CSS
-
Android
-
Python
-
C Programming
-
C++
-
C#
-
MongoDB
-
MySQL
-
Javascript
-
PHP
Connected vs Disconnected Graphs
The article is already well-structured. I'll replace the two JPG images with SVG diagrams and keep everything else intact.
In graph theory, graphs are classified as connected or disconnected based on whether there exists a path between every pair of vertices. Understanding this distinction is fundamental to analyzing graph structure and its applications.
Connected Graph
A graph is connected if there exists a path between any two vertices in the graph. In other words, starting from any vertex, you can reach every other vertex by traversing edges.
The following table shows the paths between all pairs of vertices in the connected graph above −
| Vertex 1 | Vertex 2 | Path(s) |
|---|---|---|
| a | b | a → b |
| a | c | a → b → c, a → c |
| a | d | a → b → c → d, a → c → d |
| b | c | b → a → c, b → c |
| c | d | c → d |
Every pair of vertices has at least one path between them, so the graph is connected.
Disconnected Graph
A graph is disconnected if at least two vertices are not connected by any path. If a graph G is disconnected, then every maximal connected subgraph of G is called a connected component of the graph G.
The following table shows the paths between vertex pairs in the disconnected graph above −
| Vertex 1 | Vertex 2 | Path(s) |
|---|---|---|
| a | b | a → b |
| a | c | Not Available |
| a | d | Not Available |
| b | c | Not Available |
| c | d | c → d |
Several vertex pairs (such as a–c, a–d, and b–c) have no path between them, so the graph is disconnected. This graph has two connected components − one containing vertices {a, b} and another containing vertices {c, d}.
Key Differences
| Property | Connected Graph | Disconnected Graph |
|---|---|---|
| Path between all vertex pairs | Yes | No |
| Number of connected components | Exactly 1 | 2 or more |
| Minimum edges (for n vertices) | n − 1 | Can be 0 |
Conclusion
A connected graph has a path between every pair of vertices, forming a single connected component. A disconnected graph has at least one pair of vertices with no path between them, resulting in two or more connected components.
