I want to solve a problem where is given an undirected graph and its vertices, a value k, where k is the number of vertices that should be in each connected component, and I have to find all connected components of the given graph which has only even numbers vertices. I have to find out how many such connected components are there and save the value of each vertices from each connected components.
Example: K=3 and we are given the following graph:

For that graph we have 2 connected components where all vertices are even numbers. The first connected component is made of the following vertices : 8, 2, 4; and the 2nd connected component is made of the following vertices : 2, 4, 6.
Is there an algorithm for finding the connected components in an undirected graph of a given amount of vertices? Or can anyone help me with an idea on how I should approach the problem? I've tried doing it with the DFS algorithm but I ended up nowhere.