  In this article, we study connections between components of the Cayley graph
$\mathrm{Cay}(G,A)$, where $A$ is an arbitrary subset of a group $G$, and
cosets of the subgroup of $G$ generated by $A$. In particular, we show how to
construct generating sets of $G$ if $\mathrm{Cay}(G,A)$ has finitely many
components. Furthermore, we provide an algorithm for finding minimal generating
sets of finite groups using their Cayley graphs.
