Hmmm... less conventional request than it may appear. Here is a simple take on the problem. More/less nodes can be added at will.
\documentclass{standalone}
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}
\foreach \x in {1,...,7}{%
\pgfmathparse{(\x-1)*360/8}
\node[draw,circle,inner sep=0.25cm] (N-\x) at (\pgfmathresult:5.4cm) [thick] {};
}
\pgfmathparse{7*360/8}
\node[circle,red] (N-8) at (\pgfmathresult:5.4cm) {\ldots};
\foreach \x in {1,...,7}{%
\foreach \y in {\x,...,7}{%
\path (N-\x) edge[ultra thin,-] (N-\y);
}
}
\foreach \y in {1,...,8}{%
\path (N-8) edge[red, very thick, loosely dotted] (N-\y);
}
\end{tikzpicture}
\end{document}
and the output:
Another variant, with a node drawn in dotted line with or without \ldots
inside requires some fiddling with the above code:
\documentclass{standalone}
\usepackage{tikz}
\usetikzlibrary{decorations.pathreplacing}
\begin{document}
\begin{tikzpicture}[ultra thick,decoration={border,segment length=2mm,amplitude=0.3mm,angle=90}]
\foreach \x in {1,...,7}{%
\pgfmathparse{(\x-1)*360/8}
\node[draw,circle,inner sep=0.25cm] (N-\x) at (\pgfmathresult:5.4cm) [thick] {};
}
\pgfmathparse{7*360/8}
\node[draw,circle,red,inner sep=0.25cm,decorate] (N-8) at (\pgfmathresult:5.4cm) {};
\foreach \x in {1,...,7}{%
\foreach \y in {\x,...,7}{%
\path (N-\x) edge[ultra thin,-] (N-\y);
}
}
\foreach \y in {1,...,8}{%
\path (N-8) edge[red, very thick, loosely dotted] (N-\y);
}
\end{tikzpicture}
\end{document}
Of course, you can have the \ldots
in the red dotted node, but you will have to set its inner sep
to another value (I'd suggest 0.125cm
).
EDIT:
@JLDiaz suggested to label the nodes and the last two should be labelled $n-1$
and $n$
. That sounds cool, so I decided to do just that. The trick is to replace the node drawing line in the first foreach
loop with:
\node[draw,circle] (N-\x) at (\pgfmathresult:5.4cm) [thick] {\pgfmathparse{(\x==2)?"$n$":((\x==1)?"$n-1$":int(\x-2))}\pgfmathresult};
There is a conditional in it, checking for the number of the node. Since the last node to be drawn is the one with the \ldots
, the first should contain $n-1$
and the second $n$
, so that is what the code does. int
is needed to force TikZ to print an integer, otherwise you would have something like '1.0', etc. for labels. And then there is also minimum size=3.5em
for all the nodes, which makes sure the nodes that contain only a number will be as large as the one that must accommodate $n-1$
- em
is chosen to scale if the font size changes.
Full code:
\documentclass{standalone}
\usepackage{tikz}
\usetikzlibrary{decorations.pathreplacing}
\begin{document}
\begin{tikzpicture}[ultra thick,every node/.style={minimum size=3.5em},decoration={border,segment length=2mm,amplitude=0.3mm,angle=90}]
\foreach \x in {1,...,7}{%
\pgfmathparse{(\x-1)*360/8}
\node[draw,circle] (N-\x) at (\pgfmathresult:5.4cm) [thick] {\pgfmathparse{(\x==2)?"$n$":((\x==1)?"$n-1$":int(\x-2))}\pgfmathresult};
}
\pgfmathparse{7*360/8}
\node[draw,circle,red,inner sep=0.25cm,decorate] (N-8) at (\pgfmathresult:5.4cm) {};
\foreach \x in {1,...,7}{%
\foreach \y in {\x,...,7}{%
\path (N-\x) edge[ultra thin,-] (N-\y);
}
}
\foreach \y in {1,...,8}{%
\path (N-8) edge[red, very thick, loosely dotted] (N-\y);
}
\end{tikzpicture}
\end{document}
... and ta-dah:
(Note: If I come up with something smarter, I'll edit my answer...)
- This is done by setting the width of the first node, and then fitting the other two nodes to the previous nodes, using the
fit
library.
- Same as #1.
- Solved with #1.
- This depends on what you want to do. If you only want two short nodes inside of the yellow, you can add two more nodes anchored there. But it depends on what you want to do
Output
Code
\documentclass[margin=10pt]{standalone}
\usepackage{tikz}
\usetikzlibrary{positioning,fit}
\tikzset{
every node/.style={draw, rectangle, align=center, text width=3cm, inner sep=0, thick, outer sep=0}
}
\begin{document}
\begin{tikzpicture}[node distance=5mm]
\node[fill=green!40, minimum height=2cm, minimum width=5cm, text width=3cm] (one) {This is\\block top left};
\node[fill=red!40, fit={(one.west) (one.east)}, minimum height=1cm, anchor=north west, below =of one] (two) {block bottom left};
\node[fill=yellow, fit={(one)(two)},right =of two.south east, anchor=south west] (three) {This is\\block right};
\end{tikzpicture}
\end{document}
Best Answer
Is this what you're trying to accomplish?
It seems that some kind of tweaking is going to be necessary to avoid getting a rat's nest. Here I should an approach that might suit you. (Note I changed your names for the nodes because, frankly, I found your names rather confusing.)