[Tex/LaTex] Creating a (tensor) network using TikZ

diagramsnode-connectionstensortikz-nodetikz-pgf

I am trying to draw a very simple network diagram. My code:

    \begin{tikzpicture}
    \node[draw, shape=circle] (v0) at (0,0) {$v_0$};
    \node[draw, shape=circle] (v1) at (1,0) {$v_1$};
    \node[rectangle,minimum width=6em,draw] (v3) at (0.5,-1) {$v_3$};
    \draw [thick] (v0) -- (v1)
    (v0) -- (v3)
    (v1) -- (v3);
    \end{tikzpicture}

This produces the following figure:
enter image description here

I want the lines from the upper two nodes to go straight down towards the edge of the rectangle. Is there a simple way to do this?

Best Answer

yes, it is :-):

\documentclass[tikz,
               border=3mm]{standalone}

\begin{document}
\begin{tikzpicture}
    \node[draw, shape=circle] (v0) at (0,0) {$v_0$};
    \node[draw, shape=circle] (v1) at (1,0) {$v_1$};
    \node[rectangle,minimum width=6em,draw] (v3) at (0.5,-1) {$v_3$};
    \draw [thick] (v0) -- (v1)
    (v0) -- (v0 |-  v3.north) % <-- changed coordinates
    (v1) -- (v1 |- v3.north); % <-- changed coordinates
    \end{tikzpicture}
\end{document}   

enter image description here

|- means that lines go first "verticaly" and than "horzontaly" .... (v0 |- v3.north) determine coordinate in intersection of vertical lines through v0.center and horizontal line through v3.north.