# Creating Intervals graphs

I'm trying to create the following figures using tikz:

Can anyone point me to the right way to do it? This what I have done so far:

\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{arrows}
\begin{document}
\tikz\draw [o-o] (0,0) -- +(1,0) ;
\end{document}


Thanks!

Like this:

Code:

documentclass[tikz,border=3mm]{standalone}
\usetikzlibrary{chains}
\makeatletter
\tikzset{reset join/.code={\def\tikz@after@path{}}}
\makeatother

\begin{document}
\begin{tikzpicture}[
node distance = 3mm and 12mm,
start chain = A going right,
dot/.style = {shape=circle, fill=black, inner sep=0mm, minimum size=1mm,
node contents={}, join, on chain=A},
rdot/.style = {dot, fill=red, minimum size=2mm},
bdot/.style = {dot, fill=blue, minimum size=1.5mm},
]
\node[dot,label=below:0];             % A-1
\node[rdot];
\node[dot,coordinate];
\node[bdot];
\node[dot,coordinate];
\node[rdot];
\node[dot,label=below:1];             % A-7
%
\node[rdot,reset join,above right=of A-7, label={[text=red]right: 1 player}];
\node[bdot,reset join,below right=of A-7, label={[text=blue]right:2 player}];
%
\coordinate[above=of A-1] (A-0);
\draw[shorten >=0.5mm, shorten <=0.5mm]
(A-0)           edge node[fill=white] {$\frac{1}{6}$} (A-0 -| A-2)
(A-0 -| A-2)    edge node[fill=white] {$\frac{1}{3}$} (A-0 -| A-4)
(A-0 -| A-4)    edge node[fill=white] {$\frac{1}{3}$} (A-0 -| A-6)
(A-0 -| A-6)     to  node[fill=white] {$\frac{1}{6}$} (A-0 -| A-7);
\end{tikzpicture}
\end{document}

• What does the "\tikzset{reset join/.code={\def\tikz@after@path{}}}" do? I'm rather scared of putting it in the header, seeing that its effect will likely be global. Nov 14, 2020 at 18:43
• @darijgrinberg, yes it is globa. It has effect only where is used reset join, in node in chan, which use this option interrupt join macro, i.e. not drawn arrow from previous node to it. Nov 14, 2020 at 19:29