What is the best way to typeset in LaTeX a graph of a binary relation on $\mathbb{R}$ similar to the following:

The bold lines denote a binary relation (consisting of three line segments).
What is the best way to typeset in LaTeX a graph of a binary relation on $\mathbb{R}$ similar to the following:

The bold lines denote a binary relation (consisting of three line segments).
$\text{No MWE or attempt} \mapsto \text{minimal explanations from me}$. Everything covered here is introduced in Chapter 2 of pgfmanual or at Summary of Tikz commands. This is one way, but it may not be the best way:
\documentclass[tikz]{standalone}
\begin{document}
\begin{tikzpicture}
\draw[thin,gray,text=black,<->] (0,1.4) node[left] {$y$}
|- (1.4,0) node[below] {$x\vphantom{1}$};
\draw[densely dotted,gray] (1,0) |- (0,1);
\draw[thick] (0,1) node[left] {$1$}
-- (0,0) node[below left] {$0$}
-- (1,0) node[below] {$1$}
(0,0) -- (1,1);
\end{tikzpicture}
\end{document}

$$no longer formats on this site, so you'll either have to trust us to read it correctly, or include an image. – aeroNotAuto May 01 '15 at 22:50