Given an undirected graph, return the number of connected components that are complete graphs. Pattern focus: Connected components. For each component, count its vertices and edges and verify the complete-graph condition.
n = number of vertices, edges = undirected edge list
number of complete connected components
Example 1:
Input:
n = 6 edges = [[0,1],[0,2],[1,2],[3,4]]
Output:
3
Explanation:
Component {0,1,2} is complete; {3,4} is complete; vertex 5 is isolated and complete as a size-1 component.
Example 2:
Input:
n = 4 edges = [[0,1],[1,2]]
Output:
1
Explanation:
Vertices 0,1,2 are not complete; single vertex 3 is complete.
Example 3:
Input:
n = 3 edges = [[0,1]]
Output:
2
Explanation:
Every isolated vertex is a complete component of size 1.