PROGRAMMING:Finding connected components
Try to write an algorithm to find the connected component of undirected graph G. Judge how many connected quantities there are( Let G be stored in adjacency table) [test case: Liu Donglin, level 16 of IOT project]
###Input format:
In the first line, enter positive integers V (0 < V ≤ 100) and E (0 < e ≤ 100), which are the number of vertices and undirected edges.
Enter the serial numbers (1-V) of V nodes in the next line
Next, enter two numbers for each line in line e to represent the edge between the two serial numbers
###Output format:
Output the number of connected components of the above graph( If connected, the number is 1)
###Input example:
Here is a set of inputs. For example:
```in
5 4
1 2 3 4 5
1 2
1 4
2 3
3 4
```
###Output example:
The corresponding output is given here. For example:
```out
two
```
answer:If there is no answer, please comment
###Input format:
In the first line, enter positive integers V (0 < V ≤ 100) and E (0 < e ≤ 100), which are the number of vertices and undirected edges.
Enter the serial numbers (1-V) of V nodes in the next line
Next, enter two numbers for each line in line e to represent the edge between the two serial numbers
###Output format:
Output the number of connected components of the above graph( If connected, the number is 1)
###Input example:
Here is a set of inputs. For example:
```in
5 4
1 2 3 4 5
1 2
1 4
2 3
3 4
```
###Output example:
The corresponding output is given here. For example:
```out
two
```
answer:If there is no answer, please comment