[Tex/LaTex] How to add points and overbraces to line segments in TikZ

diagramstikz-pgf

I'm trying to reproduce the following image in TikZ,

![enter image description here

except that I would like to have \overbraces over the segments between black points with V2 on top (as indicated for the middle case on the left).

What I have come up with so far is

enter image description here

using this code.

\documentclass{standalone}
\usepackage{tikz,amssymb}

\tikzset{
    realline/.pic={
        \draw [thick,<->] (0,0) -- (6,0) node [right] {$\mathbb{R}$};
    }}

\begin{document}
\begin{tikzpicture}

    \matrix (A) [column sep=20, row sep=20] {
        \pic{realline}; & \pic{realline}; \\
        \pic{realline}; & \pic{realline}; \\
        \pic{realline}; & \pic{realline}; \\
    };

\end{tikzpicture}
\end{document}

But now I'm not sure how to add the points and the braces. Some help with that would be great.

Best Answer

For starting point:

\documentclass[border=3mm,tikz]{standalone}
\usetikzlibrary{decorations.pathreplacing}
    \usepackage{amssymb}

\tikzset{
pics/realline/.style 2 args = {
    code = {\draw [thick]   (0,0) -- (6,0) node [right=2mm] {$\mathbb{R}$};
            \fill[black]    (1,0) circle (1mm) node[above=2mm] {$#1$}
                            (3,0) circle (1mm) node[above=2mm] {$#2$}
                            (6,0) circle (1mm) node[above=2mm] {$V_4$};
            \foreach \i [count=\j] in {0,0.5,1,1.5,3,4.5,6} 
                        \coordinate (-\j) at (\i,0);
    }}}

\begin{document}
    \begin{tikzpicture}[
point/.style={circle, draw, fill=white,
              inner sep=0pt, minimum size=2mm,
              label=above:#1},
 brc/.style args = {#1/#2}{decorate,
              decoration={brace, amplitude=5pt,
              raise=#1,#2},% for mirroring of brace
              thick},
                        ]  
    \matrix (A) [column sep=20, row sep=20] {
\pic (A1) {realline={V_1}{V_3}};
\node[point=$V_0$] at (A1-2) {};    & \pic{realline={V_3}{V_1}}; \\
\pic (A2) {realline={V_1}{V_3}};
\draw[brc=1.5mm/] (A2-3) -- node[above=3mm] {$V_2$} (A2-5);
                                    & \pic{realline={V_3}{V_1}}; \\
\pic (A3) {realline={V_1}{V_3}};                     
\node[point=$V_2$] at (A1-6) {};    & \pic{realline={V_3}{V_1}}; \\
                                            };% end of matrix
\end{tikzpicture}
\end{document}

enter image description here

Edit: Regarding your comments I redefined realline. Now it has two options for first two black points. If you like to have more free options, than you nedd to change realline definition to:

pics/realline/.style n args = {<number for n>}{ ...

Other points on lines or different layout of basic pic is left to you. Above code should lead you in this changes/adoptions.