connected components
connected components
Connected Components
Intorduction: Connected component (graph theory), a set of vertices in a
graph that are linked to each other by paths.
(or)
Connected component (topology), a maximal subset of a topological space that
cannot be covered by the union of two disjoint open sets.
(or)
Connected component is a subgraph in which any two vertices are connected
to each other by paths, and which is connected to no additional vertices in
the supergraph
Undirected graphs
A connected graph has only one connected component, which is the graph
itself, while unconnected graphs have more than one component. For
example, the graph shown below has three components, (0, 1, 2, 3), (4, 5, 6),
and (7, 8).
The connected
components of a graph can be
found using either a depth-first
search (DFS), or a breadth-first
search (BFS)
}
DFS(v,flag){
print v
flag[v]1
for each adjacent node u of v
do if (flag[u]==-1)
DFS(u,flag)
}
Applications
1.Spaning Trees
2.Clustering
3.Fraud detection
4.Entity Resolution
5. Component labeling is commonly used in image processing, to join
neighboring pixels into connected regions which are the shapes in the
image