Colocar texto de nodo en línea

Colocar texto de nodo en línea
\path [line] (switches) -- node {[[1, 0, 1], [0, 1, 0], [0, 1, 0], [0, 1, 0]]} (switches-ind);

coloca el texto a la derecha de la línea, arriba lo coloca a la izquierda. ¿Cómo puedo colocarlo exactamente en el medio de la línea?

ingrese la descripción de la imagen aquí

Editar: aquí hay un ejemplo completo de mi documento.

\documentclass[
a4paper,
DIV = 12,
fleqn,
liststotoc,
bibtotoc,
idxtotoc]{scrreprt}
\usepackage[pdftex]{graphicx}           %% Grafikeinbindung
\usepackage{subfigure}                   %% Bilder => Unterbilder (a),(b),.. innerhalb einer Figure
\usepackage{xcolor}  

\usepackage{tikz}
\usetikzlibrary{shapes,arrows}


% Define block styles

\definecolor{foreground}{HTML}{6200EE}
\definecolor{background}{HTML}{03DAC5}


\tikzstyle{decision} = [diamond, draw, text=white, fill=foreground, 
text width=4.5em, text badly centered, node distance=3cm, inner sep=0pt]
\tikzstyle{block} = [rectangle, draw, fill=foreground, text=white,
text width=5em, text centered, rounded corners, minimum height=4em]
\tikzstyle{input-block} = [rectangle, draw, fill=background,
text width=5em, text centered, rounded corners, minimum height=4em]
\tikzstyle{line} = [draw, -latex']
\tikzstyle{cloud} = [draw, ellipse,fill=background, node distance=3cm,
minimum height=2em]


\begin{document}
    \begin{figure}[h]
        \centering
        \begin{tikzpicture}[node distance = 3cm, auto]
        % Place nodes
        \node [block] (serial) {calculate serial modules};
        \node [input-block, left of=serial] (voltage) {desired voltage};
        \node [input-block, above of=serial] (cell-voltage) {cell voltage};
        \node [input-block, right of=serial] (number-cells) {number of cells};
        \node [block, below of=serial] (steps) {calculate steps};
        \node [block, below of=steps] (config) {compute switch config};
        \node [block, below of=config] (switches) {compute switch position};
        \node [block, below of=switches] (switches-ind) {set switch position};
        % Draw edges
        \path [line] (serial) -- node {3} (steps);
        \path [line] (steps) --  node {[1, 1, 2, 3]} (config);
        \path [line] (config) -- node {[1, 0, 0, 0]} (switches);
        \path [line] (switches) -- node [midway] {[[1, 0, 1], [0, 1, 0], [0, 1, 0], [0, 1, 0]]} (switches-ind);
        \path [line,dashed] (voltage) -- node {12} (serial);
        \path [line,dashed] (cell-voltage) --  node {4} (serial);
        \path [line,dashed] (number-cells) --  node [above] {4} (serial);

        \end{tikzpicture}
    \end{figure}

\end{document}

Resultados en esto: ingrese la descripción de la imagen aquí

Respuesta1

Supongo que estás buscando algo como esto:

ingrese la descripción de la imagen aquí

Con su código puede obtener un resultado similar si define el estilo de los nodos de borde [fill=white, anchor=center]y elimina la opción autode tikzpicturelas opciones.

*Fuera de tema: usaría quotesla biblioteca para las etiquetas de los bordes, definiría las comillas de los bordes como:

every edge quotes/.style = {fill=white, inner sep=2pt, font=\footnotesize, anchor=center},

También sugiero utilizar chainsbibliotecas positioningpara el posicionamiento de nodos:

\documentclass[tikz, border=10pt]{standalone}
\usepackage{tikz}
\usetikzlibrary{arrows.meta,
                chains,
                positioning,
                quotes}

% Define block styles
\definecolor{foreground}{HTML}{6200EE}
\definecolor{background}{HTML}{03DAC5}

\begin{document}
    \begin{tikzpicture}[
    node distance = 12mm and 11mm,
      start chain = A going below,
block/.style args = {#1/#2}{draw, rounded corners, fill=#1, text=#2,
                         text width=5em, minimum height=3*\baselineskip, align=center,
                         font=\linespread{0.84}\selectfont, on chain=A},
   block/.default = foreground/white,
every edge/.style = {draw,-{Straight Barb[angle=60:2pt 3]}},
every edge quotes/.style = {fill=white, inner sep=2pt, font=\footnotesize, anchor=center},
                        ]
        % Place nodes
\node [block=background/black]  {cell voltage};         % A-1
\node [block]   {calculate serial modules};
\node [block]   {calculate steps};
\node [block]   {compute switch config};
\node [block]   {compute switch position};
\node [block]   {set switch position};                  % A-6
%
\node [block=background/black,  left=of A-2]    {desired voltage};  % A-7
\node [block=background/black, right=of A-2]    {number of cells};  % A-8
% Draw edges
\path   (A-1)   edge[dashed,"$4$"] (A-2)
        (A-2)   edge["$3$"] (A-3)
        (A-3)   edge["${[1,1,2,3]}$"]  (A-4) 
        (A-4)   edge["${[1,0,0,0]}$"]  (A-5) 
        (A-5)   edge["${\bigl[[1,0,1], [0,1,0], [0,1,0], [0,1,0]\bigr]}$"]    (A-6)
        (A-7)   edge[dashed,"$12$"]   (A-2)
        (A-8)   edge[dashed,"$4$" ']  (A-2)
        ;
        \end{tikzpicture}
\end{document}

información relacionada