Recently I have started studying the very basics of category theory by myself, but since I'm using just some lecture notes (with are pretty concise and are more directed to categorical logic), I'm quite lost on how to deal with the few exercises I'm supposed to work on. One of them is this:
Show that taking the graph $\Gamma(f) = \{ (x, f(x))$, $x \in A \}$ of a function $f : A \rightarrow B$ defines a functor from $\mathbf{Set}$ to $\mathbf{Rel}$, which acts as identity over the objects
where Set is the category of sets with functions as morphisms and Rel, although not yet defined in the notes, I suppose is the category whose objects are sets and morphisms are relations. This exercise is in the section of forgetful functors, by the way.
What I've tried was pretty naive, essentially I've started arguing that $\Gamma$ is a subset of $A \times B$, hence a relation, but I couldn't manage to devise a functor $\mathcal{R}$ s.t. $\mathcal{R}f : A \rightarrow B$ (implicitly using that $\mathcal{R}x = x, \forall x \in \mathbf{Set}_0$) that is a relation over $A \times B$, which actually doesn't even seem to be possible and therefore suggests me that I may have assumed what Rel is wrongly.
I think you are getting confused about something here, though I'm not quite sure what. As you say, $\Gamma(f)$ is a subset of $A\times B$, so it is a relation from $A$ to $B$. So, you can just define $\mathcal{R}f=\Gamma(f)$.
To be clear, the objects of the category $\mathbf{Rel}$ are sets, and a morphism $A\to B$ in $\mathbf{Rel}$ is a relation from $A$ to $B$, i.e. a subset of $A\times B$. Composition is the usual composition of relations: if $R\subseteq A\times B$ and $S\subseteq B\times C$ then their composition is $$S\circ R=\{(a,c):\text{there exists $b\in B$ such that $(a,b)\in R$ and $(b,c)\in S$}\}.$$