Proof: compactness theorem applied to graph homomorphisms I was wondering, how could you proof the compactness theorem applied to graph homomorphisms?
Theorem to proof:
$(a)$ A graph homomorphism from graph $X$ with infinite vertices to $Y$ with finite vertices exists, exactly when $(b)$ theres a graph homomorphism from every finite subgraph $X'$ of $X$ to $Y$.
A graph homomorphism is defined like this: $h: V(X) \rightarrow V(Y)$ 
so for every single egde:
$ \{u,v\} \in E(X) ⇒\{h(u), h(v)\} \in E(Y)$
The proof should be very similar to the compactness theorem proof right?
The proof from $(a)$ to $(b)$ seems pretty obvious to me, but I struggle with proving the implication from $(b)$ to $(a)$
 A: bof has already provided a proof using the compactness theorem in the comments, as well as a link to a proof using topological compactness. 
Here is another model-theoretic proof, which shows how your problem generalizes. 
Let $M$ be an $L$-structure. Expand the language $L$ to include a new constant symbol $c_m$ for each element $m\in M$, and let $\Delta_M$ be the atomic diagram of $M$: For each atomic formula $\varphi(x_1,\dots,x_k)$, and each tuple $m_1,\dots,m_k$ such that $M\models \varphi(m_1,\dots,m_k)$, we put $\varphi(c_{m_1},\dots,c_{m_k})$ in $\Delta_M$. 
Now a model $N\models \Delta_M$ is the same as an $L$-structure $N$ given together with a homomorphism $M\to N$. Indeed, if $N\models \Delta_M$, then the map $m\mapsto c_m^N$, the interpretation of the constant symbol $c_m$ in $N$, is a homomorphism. And if $f\colon M\to N$ is a homomorphism, then interpreting $c_m^N = f(m)$ for all $m\in M$, we have $N\models \Delta_M$. 
In the case of graphs, the language is a single binary relation $E$, so the only atomic formulas are of the form $x = x$, $x = y$, $xEx$, and $xEy$, and we have $\Delta_M = \{c_m = c_m\mid m\in M\}\cup \{c_mEc_n\mid \{m,n\}\in E^M\}$. 
Theorem: Suppose $M$ is an $L$-structure and $T$ is an $L$-theory. If for every finitely generated substructure $M_0\subseteq M$ there is a model $N\models T$ and a homomorphism $M_0\to N$, then $M$ admits a homomorphism $M\to N'$ to a model $N'\models T$. 
Proof: By the observation above, it suffices to find a model $N'\models T\cup \Delta_M$. Any finite subset of this theory is contained in $T\cup \Delta_{M_0}$ for some finitely generated substructure $M_0\subseteq M$. But $T\cup \Delta_{M_0}$ is consistent by our hypothesis, so we're done by compactness. 
Ok, but note that in the proof, even if there is a single model $N$ such that every finitely generated substructure of $M$ admits a homomorphism to $N$, the compactness argument might produce a different model $N'\models T\cup \Delta_M$. This is where finiteness of $N$ comes in. 
We can apply the theorem to solve your problem, noting that (1) a finitely generated graph is finite, and (2) since $Y$ is finite, we can take $T$ to be a theory defining the graph $Y$ up to isomorphism. This would not be possible if $Y$ were infinite (since any infinite structure admits non-isomorphic elementary extensions).
