TITLE: Is there a function almost everywhere $0$ on $\mathbb{R}$ whose graph is dense in $\mathbb{R^2}$?
QUESTION [6 upvotes]: Is there a  function almost everywhere $0$  on $\mathbb{R}$ whose graph is dense in $\mathbb{R^2}$?
How to establish such strange funciton?

REPLY [3 votes]: Enumerate the countably many open rational (i.e. having rational center and radius) disks $\subseteq \mathbb R^2$ as $B_i,i\in\mathbb N$ (or take any other countable basis of the topology).
Recursively pick a sequence $(x_n,y_n)\in\mathbb R^2, n\in\mathbb N$ with the following constraints: $(x_n,y_n)\in B_n$ and $x_n\notin\{x_1,\ldots,x_{n-1}\}$. (This is possible because the first constraint allows infinitely many $x$ and the second constraint disallows only finitely many).
Now define
$$f(x)=\begin{cases}y_n&\text{if $x=x_n$ for some $n\in\mathbb N$}\\0&\text{otherwise}\end{cases}$$
Then $f$ is zero except on a countable set and its graph intersects every nonempty open set, hence is dense in $\mathbb R^2$.