Is there a Graph theory way to solve this iteration problem This thought came when i was trying to find the number of functions $f(x)$ from $\{1,2,3,4,5\}$ to $\{1,2,3,4,5\}$ that satisfy $f(f(x)) = f(f(f(x)))$ for all $x$ in $\{1,2,3,4,5\}$.  What i did was took cases when only one , two...etc  values of x such that all those are identity functions from that i got the answer as 756 which is correct.  But i was thinking if there was some kind of GT use can be done here  which can solve it more easily than case bash?

I'll give a strategy that generalizes using generating functions. As Mike Earnest points out, we want to count rooted labelled forests of size $5$ with depth at most $2$. Let's find the EGF of such forests of size $n$.
A tree is a root with a set of trees attached. Let $\mathcal T^{(2)}$ be the class of trees of depth at most $2$, and let $\mathcal Z$ denote a node. Then using the symbolic method we have
$$
\mathcal T^{(2)} = \mathcal Z\star SET(\mathcal Z\star SET(\mathcal Z))
$$
(Each use of $SET$ correspond to a possible layer). A forest is just a set of trees, so we get the following EGF
$$
\mathcal F^{(2)} = SET(\mathcal T^{(2)})
\implies F^{(2)}(z) = \exp(z\exp(z\exp(z)))
$$
The number of these forests that have $n$ nodes is then given by $F_n^{(2)} = n![z^n]F^{(2)}(z)$, where $[z^n]$ means the coefficient at $z^n$ in the series expansion of the EGF. We find
$$ \begin{split}
F^{(2)}(z) &= \exp(z\exp(z\exp(z))) \\
&= \sum_{m\ge0}\frac{z^me^{mze^z}}{m!}\\
&= \sum_{m\ge0}\frac{z^m}{m!} \sum_{k\ge0}\frac{m^kz^ke^{kz}}{k!}\\
&= \sum_{m\ge0}\frac{z^m}{m!} \sum_{k\ge0}\frac{m^kz^k}{k!}  \sum_{j\ge0}\frac{k^jz^j}{j!}\\
&= \sum_{m,k,j\ge0}\frac{m^kk^j}{m!k!j!}z^{m+k+j}\\
&= \sum_{n\ge0} \left(\sum_{m=0}^n \sum_{k=0}^{n-m} \frac{m^kk^{n-m-k}}{m!k!(n-m-k)!}\right)z^n
\end{split}$$
So our final answer is
$$
F_n^{(2)} = n! \sum_{m=0}^n \sum_{k=0}^{n-m} \frac{m^kk^{n-m-k}}{m!k!(n-m-k)!}
$$
and we can verify that $F_5^{(2)}$ is indeed $756$ using this formula. You can find the sequence at A949 on OEIS. I don't know if we can do much more than this, other than cleaning up the edge cases and perhaps rewriting with a trinomial coefficient:
$$
F_n^{(2)} = 1 + \sum_{m=1}^{n-1} \sum_{k=1}^{n-m}\binom{n}{m,k,n-m-k} m^kk^{n-m-k}
$$
