3

I tried to use Tikz to draw large graphs with specific toologies and I am running into some problems. Since not all nodes can be represented explicitly, I am forced to use an ellipsis. I tried to define this ellipsis as a node, but the dots appear horizontally and not as shown in figure, i.e., it would be great if the ellipsis are three adjacent points on the circumference of the circle where other nodes rest.

The same problem arises even when I have a complete graph. Can someone help me out with this? Thanks!

Star Complete

Code so far:

\begin{tikzpicture}[->,>=stealth', shorten>=1pt, auto, node distance=2.8cm, semithick]
 \tikzstyle{peer}=[draw,circle,violet,bottom color=\lav, top color= white, text=violet, minimum width=8pt]
 \tikzstyle{superpeer}=[draw, circle, burntorange, left color=\oran, text=violet, minimum width=25pt]
  \node[superpeer] (A) {$0$};
  \node[peer]         (B)  at ($ (A) + (20:4) $) {$1$};
  \node[peer]         (C)  at ($ (A) + (-52:4) $) {$2$};
  \node[peer]         (D)   at ($ (A) + (-124:4) $){$3$};
  \node[draw=none] (F)  at ($ (A) + (-176:4) $){$\cdots$};  
  \node[peer] (E) at ($ (A) + (92:4) $) {$N$};

  \path (A) edge [color=blue, sloped] node[]{$\lambda_{01}, \mu_{01}$} (B);
  \path (A) edge [color=blue, sloped] node[] {$\lambda_{02}, \mu_{02}$} (C);
  \path (A) edge [color=blue, sloped] node[] {$\lambda_{03}, \mu_{03}$}(D);
  \path (A) edge [color=blue, sloped, below] node[] {$\lambda_{0N}, \mu_{0N}$} (E);
  \path (B) edge [color=blue, sloped] node[] {$\lambda_{10}, \mu_{10}$}(A);
  \path (C) edge [color=blue, sloped] node[] {$\lambda_{20}, \mu_{20}$}(A);
  \path (D) edge [color=blue, sloped] node[] {$\lambda_{30}, \mu_{30}$}(A);
  \path (E) edge [color=blue, sloped, above] node[] {$\lambda_{N0}, \mu_{N0}$}(A);
\end{tikzpicture}
  • 2
    Please turn this into a compilable MWE including \documentclass and the appropriate packages. This is especially important with tikz as there are numerous libraries. – Peter Grill Feb 15 '14 at 19:01
2

This is another possible solution. Since don't have the definition of \lav color, red is used. The solution uses (A.<angle>) for the two lines drawn between nodes. The lines are -20 <center angle> +20 degrees apart. p1, p1 and p2 can be adjusted to show closeness between them

enter image description here

Code

\documentclass[border=10pt]{standalone}
\usepackage{tikz}
\usetikzlibrary{shapes,snakes,arrows,shadows,calc,positioning,automata}
\usepackage{xcolor}
\usetikzlibrary{shapes}
\begin{document}

\tikzset{%
peer/.style={draw,circle,violet,bottom color=red, top color= white, text=violet, minimum width=25pt},
superpeer/.style={draw, circle,  left color=orange, text=violet, minimum width=25pt},
point/.style = {fill=black,inner sep=2pt, ellipse, minimum width=10pt,align=right,rotate=60},
forward edge/.style={->, >=stealth, shorten >=0pt, thick, color=blue},
}
\begin{tikzpicture}[auto, node distance=2.8cm]

  \node[superpeer] (A) {$0$};
  \node[peer]  (B)   at ($ (A) + (18:4) $){$1$};  % 72 degree apart
  \node[peer]  (C)   at ($ (A) + (306:4)$){$2$};
  \node[peer]  (D)   at ($ (A) + (234:4)$){$3$};
  \node[point] (p1)  at ($ (A) + (172:4) $){};  
  \node[point] (p2)  at ($ (A) + (162:4) $){};            % center angle  
  \node[point] (p3)  at ($ (A) + (152:4) $){};  
  \node[peer] (E) at ($ (A) + (90:4) $) {$N$};

\path [forward edge] (A.38) edge [sloped,above=1cm] node[label=above:{$\lambda_{01}$}]{}(B.178);
\path [forward edge,] (B.218) edge [sloped,below=1cm] node[label=below:{$\mu_{01}$}]{} (A.-2);

 \path [forward edge] (A.326) edge [sloped] node[] {$\lambda_{02}$} (C.106);
 \path [forward edge] (C.146) edge [sloped] node[] {$\mu_{02}$} (A.286);

  \path [forward edge] (A.214) edge [sloped] node[label={[shift={(0ex,-1ex)}]above:{$\lambda_{03}$}}] {}(D.74);
  \path [forward edge] (D.34) edge [sloped] node[label={[shift={(0ex,2ex)}]below:{$\mu_{03}$}}] {}(A.254);

 \path [forward edge] 
(A.70) edge [sloped] node[label={[shift={(-3ex,-1ex)}]left:{$\lambda_{0N}$}}] {} (E.290) 
(E.250) edge [sloped] node[label={[shift={(-3ex,-1ex)}]right:{$\mu_{0N}$}}] {} (A.110);
\end{tikzpicture}



\end{document}
2

Remarks

I guess your question was, how to rotate the dots, such that they match the sample picture you posted. We know, that therefore it needs to be orthogonal to the path pointing there from the origin. With some simple mathematics we find

-176 + 90 = -86

Hence the node needs to be rotated by -86°.

\node[rotate=-86] (F) at ($(A) + (-176:4)$) {\mydots};

To get scaled dots, I introduced a macro \mydots. If you want to use the default Computer Modern fonts in the OT1 encoding you might want to declare

\newcommand*\mydots{{\Huge$\cdots$}}

If you load a scalable font like Latin Modern, you can specify arbitrarily large dots

\usepackage{lmodern}
\newcommand*\mydots{{\fontsize{60}{80}\selectfont$\cdots$}}

(I added an extra level of grouping, if you want to use it in another context and don't want the surroundings to be scaled as well)

Complete example

\PassOptionsToPackage{dvipsnames}{xcolor}
\documentclass[tikz]{standalone}
\usetikzlibrary{arrows,calc}
\newcommand*\lav{Lavender}
\newcommand*\oran{Orange}
% We need a scalable font for this
\usepackage{lmodern}
\newcommand*\mydots{{\fontsize{60}{80}\selectfont$\cdots$}}
%\newcommand*\mydots{{\Huge$\cdots$}}% <- Without scalable font
\tikzset{
    peer/.style={
        draw,
        circle,
        violet,
        bottom color=\lav,
        top color= white,
        text=violet,
        minimum width=8pt
    },
    superpeer/.style={
        draw,
        circle,
        BurntOrange,
        left color=\oran,
        text=violet,
        minimum width=25pt
    }
}
\begin{document}
\begin{tikzpicture}[
        ->,
        >=stealth',
        shorten >=1pt,
        auto,
        node distance=2.8cm,
        semithick
    ]
    \node[superpeer]  (A)                       {$0$};
    \node[peer]       (B) at ($(A) + (20:4)$)   {$1$};
    \node[peer]       (C) at ($(A) + (-52:4)$)  {$2$};
    \node[peer]       (D) at ($(A) + (-124:4)$) {$3$};
    \node[rotate=-86] (F) at ($(A) + (-176:4)$) {\mydots};  
    \node[peer]       (E) at ($(A) + (92:4)$)   {$N$};

    \path (A) edge[color=blue,sloped]       node {$\lambda_{01}, \mu_{01}$} (B);
    \path (A) edge[color=blue,sloped]       node {$\lambda_{02}, \mu_{02}$} (C);
    \path (A) edge[color=blue,sloped]       node {$\lambda_{03}, \mu_{03}$} (D);
    \path (A) edge[color=blue,sloped,below] node {$\lambda_{0N}, \mu_{0N}$} (E);
    \path (B) edge[color=blue,sloped]       node {$\lambda_{10}, \mu_{10}$} (A);
    \path (C) edge[color=blue,sloped]       node {$\lambda_{20}, \mu_{20}$} (A);
    \path (D) edge[color=blue,sloped]       node {$\lambda_{30}, \mu_{30}$} (A);
    \path (E) edge[color=blue,sloped,above] node {$\lambda_{N0}, \mu_{N0}$} (A);
\end{tikzpicture}
\end{document}

Output

enter image description here

  • Thanks Henri, but I am looking for thick ellipis which are distinctly visible between 3 and N. Is there some font-based ellipsis where I could increase the font-size? – Bravo Feb 16 '14 at 10:14
  • @Bravo See my updated answer. – Henri Menke Feb 16 '14 at 10:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.