I've never actually seen a definition of a function in terms of relations, but I do know that functions are essentially special types of relations (I don't like to use this terminology, is it correct to instead say functions are subsets of relations?)
Definition (Relation):
Let $A$ and $B$ be two sets. A binary relation $R$ between $A$ and $B$ is a subset of $A \times B$. $$R \subset A \times B = \{ (a, b) | \ a \in A \ \text{and} \ b \in B \}$$
Now I attempt to define a function (as I have not yet seen a definition in terms of relations) as follows.
Definition (Functions):
Let $A$, $B$ be two sets, and $R$ a binary relation, then define $f : A \to B$, such that $$f \subset R \subset A \times B \ \ \text{ such that} \ \ (a, b) \in f \ \text{and} \ (a, b') \in f \implies b = b'$$ And notation-wise we put $$f(a) = b$$
Now I don't know if this is an actual concept (if it is please let me know), but it would seem that the set of all functions from $A \to B$, would be defined as follows
Definition (Set of all possible Functions):
Given the above definition, the set $S$ of all possible functions from $A \to B$ is as follows. $$S = \{ f \ | \ (a, b) \in f \ \text{and} \ (a, b') \in f \implies b = b' \}$$
First off, is my attempted definition of a function correct (and is it correct to say that functions are just subsets of relations)?
Secondly is my definition of the set of all possible functions correct?
Finally is my definition of the set of all possible functions, the definition of a function space?
Functions are, as you might already noticed, relations themselves. In fact $$f=\{ (a,b_a) |\; a\in A, \; \; b_a \in B \}$$ i.e. to each $a$ from set $A$ exists unique $b_a \in B$ such that $(a,b_a)\in f$. Hence $f\subset A\times B$ is a relation. As far as set of all possible functions is concerned, I'd put it like this: $$S=\{f \subset A\times B |\; (a,b)\in f \text{ and } (a,b')\in f \implies b=b' \}.$$ And lastly, S is a function space, but without placing some requirements on those functions, like continuity for example, it usually won't have many useful properties in general.