ConnectedComponents
ConnectedComponents[g] gives the connected components of the graph g.
ConnectedComponents[g,{v1,v2,…}] gives the connected components that include at least one of the vertices v1, v2, … .
ConnectedComponents[g,patt] gives the connected components that include a vertex that matches the pattern patt.
ConnectedComponents[{v->w,…},…] uses rules v->w to specify the graph g.
Please visit the official Wolfram Language Reference for more details and examples on core symbols.