Problem - https://www.geeksforgeeks.org/problem...
Given an undirected graph with v vertices(numbered from 1 to v) and e edges. Find the number of good components in the graph.
A component of the graph is good if and only if the component is fully connected.
Note: A fully connected component is a subgraph of a given graph such that there's an edge between every pair of vertices in the component, the given graph can be a disconnected graph.
Example 1:
Input:
e=3
v=3
edges={{1, 2},{1, 3},{3, 2}}
Output:
1
Explanation:
We can see that there is only one component in the graph and in this component there is a edge between any two vertces.
Example 2:
Input:
e=5
v=7
edges={{1, 2},{7, 2},{3, 5},{3, 4},{4, 5}}
Output:
2
Explanation:
We can see that there are 3 components in the graph. For 1-2-7 there is no edge between 1 to 7, so it is not a fully connected component. Rest 2 are individually fully connected component