In what manner are functions sets? From Introduction to Topology, Bert Mendelson, ed. 3, page 15:

A function may be viewed as a special case of what is called a relation.

Yet, a relation is a set

A relation $R$ on a set $E$ is a subset of $E\times E$.

while a function is a correspondence or rule.  Is then a function also a set?
 A: Others have said, clearly and nicely, how to represent or model functions by sets. 
And that's the right way to put it. Here are three reasons not to say that functions are sets.


*

*It might be conventional to treat the binary function $f(x) = y$ as corresponding to a certain set of ordered pairs $(x, y)$, and then  treat the ordered pairs by the Weiner-Kuratowski construction. But at both steps we are making arbitrary choices from a range of possibilities. You could use the set of ordered pairs (y, x) [I've seen that done], and you could choose a different set-theoretic representation of ordered pairs [I've seen that done]. Since the conventional association of the function with a set involves arbitrary choices, there isn't a unique right way of doing it: none, then, can be reasonably said to reveal what a function really is. We are in the business of representing (relative to some chosen scheme of representation).

*Some functions are "too big" to have corresponding sets. Take the function that maps a set to its singleton. The ordered pairs $(x, \{x\})$ are too many to form a set. If a function is too big to have a corresponding set, it can't be that set.

*Most importantly, it would be a type confusion to identify a function with an object like a set. A function maps some object(s) to an object. In terms of Frege's nice metaphor, functions are "unsaturated", come with one or more slots waiting to be filled (where filling the single slot in, say, the unary numerical function the square of ... gives us a number). In modern terminology, functions have an intrinsic arity.  By contrast, objects aren't unsaturated, don't have slots waiting to be filled, don't have arities, don't do mapping. And what applies to objects in general applies to those objects which are sets in particular. So functions aren't sets.
A: Let's begin at the other end.
A function can be regarded as a rule for assigning a unique value $f(x)$ to each $x$. Let's construct a set $F$ of all the ordered pairs $(x,f(x))$.
If $f:X\to Y$ we need every $x\in X$ to have a value $f(x)$. So for each $x$ there is an ordered pair $(x,y)$ in the set for some $y\in Y$. We also need $f(x)$ to be uniquely defined by $x$ so that whenever the set contains $(x,y)$ and $(x,z)$ we have $y=z$. In this way there is a unique $f(x)$ for each $x$ as we require.
The ordered pairs can be taken as elements of $X \times Y$ so that $F\subset X \times Y$
If we have a set of ordered pairs with the required properties, we can work backwards and see that this gives us back our original idea of a function.
A: Functions correspond to an abstract rule. Not to something like $f(x)=x+3$. This abstract rule need not be expressible, or even something that you can imagine. Functions, just like any other mathematical object, can be represented as a set. For example, real numbers can be thought of as sets.
Functions are represented as sets of ordered pairs. When we say that $f$ is a function from $X$ into $Y$ then we mean to say that $f$ is a set of ordered pairs $(x,y)$ such that $x\in X$ and $y\in Y$, and the following holds:


*

*For every $x\in X$ there is some $y\in Y$ such that $(x,y)\in f$.

*If $(x,y)\in f$ and $(x,y')\in f$ then $y=y'$.


When the latter occurs we can simply replace the $y$ by $f(x)$.
For example, $\{(0,0),(1,0)\}$ is a function from $\{0,1\}$ into $\{0\}$. 
A: Yes, a function $f:X\to Y$ can be modeled by a set. 
And yes, a function can be thought of as a special case of a relation, that is, a subset $R\subseteq X\times Y$. ("Function" after all can be thought of as shorthand for "functional relation.")
This is just reexpressing $f(x)=y$ as $(x,y)\in R$. So, the regular "function-is-a-rule" picture is equivalent to thinking of a subset $f\subseteq X\times Y$, where the set $f$ has special properties that make it a function. (The properties you are probably familiar with, I imagine.)
Relations don't have to be on the same set, as you gave as an example. However, when people say "relation on $E$", that is just shorthand for "relation from $E$ to $E$."
