Location of label edges in Tikz Graph
Here you are! parameters \a
, \b
make the code easier to adjust!
\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage[margin=1cm]{geometry}
\usepackage{tikz}
\usetikzlibrary{decorations.pathreplacing} % for brace
\begin{document}
\begin{tikzpicture}
[n/.style={circle,fill=gray!50,minimum size=8mm}]
\def\a{2}
\def\b{3.5}
\path
(0,0) node[n] (R) {}
+(0,\a) node[n] (Ru) {}
+(0,-\a) node[n] (Rb) {}
+(\b,.5*\a) node[n,outer sep=1mm] (Lu) {}
+(\b,-.5*\a) node[n,outer sep=1mm] (Lb) {};
\draw[->] (Ru)--(Lu) node[pos=.2,above=-1mm,sloped] {$\omega_{1,1}$};
\draw[->] (Ru)--(Lb) node[pos=.85,above=-1mm,sloped] {$\omega_{2,1}$};
\draw[->] (R)--(Lu) node[pos=.2,above=-1mm,sloped] {$\omega_{1,2}$};
\draw[->] (R)--(Lb) node[pos=.75,above=-1mm,sloped] {$\omega_{2,2}$};
\draw[->] (Rb)--(Lu) node[pos=.2,above=-1mm,sloped] {$\omega_{1,3}$};
\draw[->] (Rb)--(Lb) node[pos=.7,above=-1mm,sloped] {$\omega_{2,3}$};
\draw[decorate,decoration={brace},gray] (\b+1,\a)--(\b+1,-\a);
\path (\b+1.5,0) node[right]{$\mathbf{\Omega=}$};
\end{tikzpicture}
\end{document}
Just a few changes to your code:
\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage[margin=1cm]{geometry}
\usepackage{tikz,pgfplots,pgf}
\usetikzlibrary{matrix,shapes,arrows,positioning}
\begin{document}
\[
\left.
\begin{tikzpicture}[>=to,baseline]
\path
+(0,-1) node[circle,scale=2, fill=lightgray] (S) {}
+(0,1) node[circle,scale=2, fill=lightgray] (K) {}
+(-3,1.5) node[circle, scale = 2,fill=lightgray] (x1) {}
+(-3,0) node[circle,scale = 2, fill=lightgray] (x2) {}
+(-3,-1.5) node[circle, scale = 2,fill=lightgray] (x3) {};
\draw[->, gray] (x1)--(S) node[sloped, pos=.8,above, yshift=-1mm, black]{\small$\omega_{2,1}$};
\draw[->, gray] (x2)--(S) node[sloped, pos=.8,above, yshift=-1mm, black]{\small$\omega_{2,2}$};
\draw[->, gray] (x3)--(S) node[sloped, pos=.8,above, yshift=-1mm, black]{\small$\omega_{2,3}$};
\draw[->, gray] (x1)--(K) node[sloped, pos=.2,above, yshift=-1mm, black]{\small$\omega_{1,1}$};
\draw[->, gray] (x2)--(K) node[sloped, pos=.2,above, yshift=-1mm, black]{\small$\omega_{1,2}$};
\draw[->, gray] (x3)--(K) node[sloped, pos=.2,above, yshift=-1mm, black]{\small$\omega_{1,3}$};
\end{tikzpicture}
\quad\right\}\quad\Omega=
\]
\end{document}
fill=lightgray
to color the nodes (or you can usegray!50
or any percentage- delete
draw
to remove border circles gray
for arrow color (butblack
for label color)- include
sloped
to have labels follow arrows - negative
yshift
to reduce space between arrow and label >=to
for desired arrowheadsbaseline
so that the brace is placed correctly with respect to the diagram\left.
and\right\}
for right-only brace\small
to reduce label sizes. (\footnotesize
would be even smaller)