Let f: R > R be any function. When is the graph of f dense in R^2 ? The only examples I know for this are for nonmeasurable functions, but is that a necessary condition ?

The Conway base 13 function is probably a standard example: the graph is dense because any restriction of the function to an open interval is surjective. But meanwhile, since the graph of the base 13 function is easily defined by an arithmetic property of the digits, the function is Borel and hence measurable. More information is available at Is Conway's base13 function measurable? 


For each $q\in\mathbb Q$ choose a sequence $x_{q,n}\to q$ $(n\to\infty)$ such that all $x_{q,n}$ are pairwise distinct. For $\mathbb Q=\lbrace r_n:n\in\mathbb N\rbrace$ define $f(x_{q,n})=r_n$ and $f(x)=0$ for $x\notin \lbrace x_{q,n}: q\in\mathbb Q, n\in\mathbb N\rbrace.$ Then $f$ is measurable and its graph is dense. 


Another example is any of the denegenerate solutions of the Cauchy functional equation http://en.wikipedia.org/wiki/Cauchy's_functional_equation#Properties_of_other_solutions , which has also the property of being measurable; unfortunately, I don't know when this condition is achieved, due to the notsoeasy construction of the function: maybe using the linearity one can show something, I don't know... However this class of function suggests a solution to your problem, for example $f(a+ \sqrt{2} b ) = a  \sqrt{2} b$ whenever $a,b \in \mathbb{Q}$ and $f \equiv 0$ out of $\mathbb{Q} ( \sqrt{2} )$. In this way you have a measurable function (because it is $0$ out of a countable set) and it has the property of the dense graph. 

