2

I have the following basic code. I need to draw a network as follows. Can someone amend this code for me?

enter image description here

MWE:

\documentclass{article}

\usepackage{subcaption, pgf, tikz,geometry, hyperref}
\geometry{left=1in,right=1in,top=1in,bottom=1in}
\usepackage{tikz}
\usetikzlibrary{arrows, automata, calc}

\begin{document}
\begin{figure}  
\centering  

\begin{tikzpicture}[
> = stealth, % arrow head style
shorten > = 1pt, % don't touch arrow head to node
auto,
node distance = 3cm, % distance between nodes
semithick % line style
]

\tikzstyle{every state}=[
draw = black,
thick,
fill = white,
minimum size = 4mm
]
\node (a) {...};
\node[state] (b) at ($ (a) + (0:2) $) {m};
\node (a0)  at ($ (b) + (90:1) $) {};
\node (c) at ($ (b) + (0:2) $) {...};
\node[state] (d) at ($ (a) + (-45:1.5) $) {j};
\node[state] (e) at ($ (b) + (-45:1.5) $) {k};
\node[state] (f) at ($ (d) + (-45:1.5) $) {i};

\path[] (a) edge node {$\dots$} (b);
\path[] (b) edge node {$\vdots$} (a0);
\path[->] (a) edge node {} (d);
\path[->] (b) edge node {} (d);
\path[->] (b) edge node {} (e);
\path[->] (c) edge node {} (e);
\path[->] (d) edge node {} (f);
\path[->] (e) edge node {} (f);
\end{tikzpicture}

\caption{Assembly topology with diamond}
\end{figure}    

\end{document}

My result is:

enter image description here

3
  • 2
    Welcome to TeX.SX! I think your result and your image are quiet the same. What is missing? Do you need ellipsis instead of circles?
    – Bobyandbob
    Oct 19, 2017 at 13:37
  • Thanks @Bobyandbob. I do not want the lines next to $m$. I want the dots at the same location as my handmade figure.
    – Figman
    Oct 19, 2017 at 13:41
  • Replace \path[] (a) edge node {$\dots$} (b); \path[] (b) edge node {$\vdots$} (a0); with \node (nord) at ($ (b) + (90:0.7) $) {\vdots}; You could use\node (a) {\dots}; instead of \node (a) {...};.
    – Bobyandbob
    Oct 19, 2017 at 15:39

1 Answer 1

4

edge command draws a line by default, if you don't want it use edge[draw=none]. But this option won't draw dots where you want.

As an alternative solution I propose following code. It shows some changes respect the original one:

The result looks like:

enter image description here

And the code:

\documentclass{article}

\usepackage{subcaption, pgf, tikz,geometry, hyperref}
\geometry{left=1in,right=1in,top=1in,bottom=1in}
\usepackage{tikz}
\usetikzlibrary{arrows, automata, calc, positioning}

\begin{document}
\begin{figure}  
\centering  

\begin{tikzpicture}[
> = stealth, % arrow head style
shorten > = 1pt, % don't touch arrow head to node
auto,
node distance = 3cm, % distance between nodes
semithick, % line style
every state/.style={
    draw = black,
    thick,
    fill = white,
    minimum size = 4mm
}
]

\node (a) {\dots};
\node[state, right=2cm of a] (b) {m};
\node[right=2cm of b] (c) {\dots};
\node[above=1mm of b] {\vdots};
\node[state, below left=1cm and 1cm of b] (d) {j};
\node[state, below right=1cm and 1cm of b] (e) {k};
\node[state, below right=1cm and 1cm of d] (f) {i};

\path[->] (a) edge node {} (d);
\path[->] (b) edge node {} (d);
\path[->] (b) edge node {} (e);
\path[->] (c) edge node {} (e);
\path[->] (d) edge node {} (f);
\path[->] (e) edge node {} (f);
\end{tikzpicture}

\caption{Assembly topology with diamond}
\end{figure}    

\end{document}

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.