3

I used tikz to draw a digraph as follows -

 \begin{tikzpicture}[roundnode/.style={circle, draw=black!60, very thick,minimum size=4mm}]
            %Nodes
            \node[roundnode]      (u1)                     {$u_1$};
            \node[roundnode]      (u2)       [right=of u1] {$u_2$};
            \node[roundnode]      (u3)       [below right=of u2] {$u_3$};
            \node[roundnode]      (u4)       [below left =of u3] {$u_4$};
            \node[roundnode]      (u5)       [left =of u4] {$u_5$};
            \node[roundnode]      (u6)       [below left =of u1] {$u_6$};

            %Lines
            \draw[->] (u2) -- (u5);
            \draw[->] (u2) -- (u6);
            \draw[->] (u3) -- (u5);
            \draw[->] (u3) -- (u6);
            \draw[->] (u4) -- (u5);
            \draw[->] (u4) -- (u6); 
          \end{tikzpicture}

This gives

enter image description here

However I want the nodes to be small dots with the vertex labelled next to it.

Can someone help me with this?

Thank you.

2 Answers 2

6

Like this?

enter image description here

\documentclass[tikz,border=2mm]{standalone} 
\usetikzlibrary{positioning, fit}

\begin{document}
\begin{tikzpicture}[roundnode/.style={circle, fill=black!60, inner sep=0pt, minimum size=4mm}]

    \foreach \i [count=\ni] in {120, 60, ..., -180}
        \node[roundnode, label=\i:{$u_\ni$}] at (\i:2cm) (u\ni) {};

            %Lines
            \draw[->] (u2) -- (u5);
            \draw[->] (u2) -- (u6);
            \draw[->] (u3) -- (u5);
            \draw[->] (u3) -- (u6);
            \draw[->] (u4) -- (u5);
            \draw[->] (u4) -- (u6); 
          \end{tikzpicture}
\end{document}
0
4

For example you can use minimum size=<...>. The label positioning you can handle wir label={north:$u_1$} /south, east, west or south west etc. .

Alternativ you can use \node[circle,fill,inner sep=1pt,label={north west:$u_1$}] (u1) {}; or as style in preamble with \tikzstyle{every node}=[draw,shape=circle,fill,inner sep=1pt].

enter image description here

MWE:

\documentclass{article}

\usepackage{tikz}
\usetikzlibrary{positioning}
\begin{document}

\begin{tikzpicture}[roundnode/.style={draw,shape=circle,fill=blue,minimum size=1mm}]
        %Nodes
        \node[circle,fill,inner sep=1pt,label={north west:$u_1$}]      (u1)                     {};
            \node[roundnode,label={north east:$u_2$}]      (u2)       [right=of u1] {};
            \node[roundnode,label={east:$u_3$}]      (u3)       [below right=of u2] {};
            \node[roundnode,label={south east:$u_4$}]      (u4)       [below left =of u3] {};
            \node[roundnode,label={south west:$u_5$}]      (u5)       [left =of u4] {};
            \node[roundnode, label={west:$u_6$}]      (u6)       [below left =of u1] {};
            %Lines
            \draw[->] (u2) -- (u5);
            \draw[->] (u2) -- (u6);
            \draw[->] (u3) -- (u5);
            \draw[->] (u3) -- (u6);
            \draw[->] (u4) -- (u5);
            \draw[->] (u4) -- (u6); 
          \end{tikzpicture}
\end{document}
0

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .