Below dfs function will be used to get the connected components of a graph and stores all the connected nodes in the vector component
void dfs ( int src , vector < bool > & visited , vector < vector < int > > & graph , vector < int > & component , int N ) {