0

I want to I connect nodes around a center node. Example could be seen as below:

enter image description here

my approach:

\documentclass[border={10pt}]{standalone}
\usepackage{tikz}
\usetikzlibrary{positioning,arrows}

\begin{document} \begin{tikzpicture} [%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% node distance=1cm, arrow/.style={->, >=stealth, very thick}, block/.style={rectangle, fill=blue!20, text centered, rounded corners, minimum height=1em} ]%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \node[block] (A) {A}; \node[block] (B) [above=of A] {B}; \node[block] (K) [right=of B] {K}; \node[block] (C) [left=of A] {C}; \node[block] (D) [right=of A] {D}; \node[block] (E) [below=of A] {E}; \node[block] (F) [right=of E] {F}; \node[block] (G) [left=of E] {G};

%connect nodes
\draw [arrow] (B.south) -- ++(0,-0) -| (A.north);
\draw [arrow] (C.east) -- ++(0,-0) -| (A.west);
\draw [arrow] (E.north) -- ++(0,-0) -| (A.south);
\draw [arrow] (D.west) -- ++(0,-0) -| (A.east);
\draw [arrow] (F.north) -- ++(0,-0) -| (A.southeast);
\draw [arrow] (G.north) -- ++(0,-0) -| (A.west);
\draw [arrow] (K.south) -- ++(0,-0) -| (A.east);

\end{tikzpicture} \end{document}

output:

enter image description here

where I was not able to put nodes into cross locations, in between B - D , D - E , C - E , and B - C.

Related: https://tex.stackexchange.com/a/269910/127048

Ingmar
  • 6,690
  • 5
  • 26
  • 47
alper
  • 1,389

1 Answers1

1

I wouldn't use positioning for this. Place the A node as you did, then use polar coordinates to place the other nodes. You can set angles and distances however you like for each node.

Since it seems you want straight arrows, don't use -|, which makes your lines horizontal then vertical. Simplify your code and use \draw [arrow] (B) -- (A);

enter image description here

\documentclass{article}
\usepackage{tikz}

\begin{document} \begin{tikzpicture} [%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% arrow/.style={->, >=stealth, very thick}, block/.style={rectangle, fill=blue!20, text centered, rounded corners, outer sep=0pt} ]%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \node[block] (A) {A}; \node[block] at (120:2) (B) {B}; \node[block] at (60:1.5) (K) {K}; \node[block] at (150:1.5) (C) {C}; \node[block] at (-10:2) (D) {D}; \node[block] at (240:2) (E) {E}; \node[block] at (300:1.5) (F) {F}; \node[block] at (210:1.5) (G) {G};

%connect nodes
\draw [arrow] (B) -- (A);
\draw [arrow] (C.south east) -- (A.west);
\draw [arrow] ([yshift=2mm]A.west) -- ([yshift=2mm]C.south east);
\draw [arrow] (E) -- (A);
\draw [arrow] (D) -- (A);
\draw [arrow] (F) -- (A);
\draw [arrow] (G) -- (A);
\draw [arrow] (G) -- (C);
\draw [arrow] (K) -- (A);

\end{tikzpicture} \end{document}

Sandy G
  • 42,558
  • If C is very long text like Reseacher is it possible to shift it to the right? – alper May 26 '22 at 18:48
  • 1
    @alper: Yes. Try adjusting the angle and distance. For example, \node[block] at (160:2.5) (C) {Researcher}; – Sandy G May 26 '22 at 18:53