3

I need to draw a 4*4 request response node in tikz. I have tried a lot, as i am new and learning tikz, so it difficult for me. Furthermore I am attaching the images that are needed in my work. Any help is greatly appreciated.

Thanks in Advance.

The source is as follows:

For Fig. 1

\documentclass[12pt,a4paper,twoside]{report}
\usepackage{tikz}
\usetikzlibrary{positioning}
\begin{document}
\begin{figure}
\centering
\begin{tikzpicture}[
mybox/.style={
text width=2cm,
minimum height=3cm,
minimum width=2cm,
node distance=5cm,
align=center,
ultra thick,
draw},
myarrow/.style={
->,
>=stealth,
thick
}
]
\node [mybox](sa) {Service A};
\node [mybox,right=of sa] (sb) {Service B};
\node [mybox,below of=sa] (sc) {Service C};
\node [mybox,below of=sb] (sd) {Service D};
\draw [myarrow] (sa.east) +(0,-1em) coordinate (b1) -- node [above]  {send} (sb.west |- b1) ;
\draw [myarrow] (sb.west) +(0,1em) coordinate (b1) --node[above] {receive} (sa.east |- b1);
\draw [myarrow] (sc.east) +(0,-1em) coordinate (b1) -- node [above] {send} (sd.west |- b1) ;
\draw [myarrow] (sd.west) +(0,1em) coordinate (b1) --node[above] {receive} (sc.east |- b1);
\draw [myarrow] (sa.south) +(2,-2cm) coordinate (b1) -- node [below] {send} (sc.north |- b1) ;
\end{tikzpicture}
\end{figure} 
\end{document}

The main concern is that how to show the request response message between A - D, and between B and C. Rest all is specified and working perfectly. What to do for generating a thick arrows (used in block diagram) instead of thin and simple arrows?

For Fig. 2. How to generate the curve arrows in tikz and how to place the master in between the four nodes, as created in Fig. 1?? Rounded rectangles how to draw it, instead of plain simple rectangles?

enter image description here

5

first image:

enter image description here

\documentclass[12pt, tikz, margin=3mm]{standalone}
\usetikzlibrary{arrows.meta, positioning, quotes}

\begin{document}
    \begin{tikzpicture}[
node distance = 44mm and 44mm,
 mybox/.style = {draw, ultra thick,
                 text width=22mm, minimum height=11mm, align=center,
                 inner sep=2mm, outer sep=0mm},
    ys/.style = {yshift=#1},
    xs/.style = {xshift=#1}
                        ]
    \begin{scope}[every node/.style={mybox}]
\node (sa)                  {Service A};
\node (sb)  [right=of sa]   {Service B};
\node (sc)  [below=of sa]   {Service C};
\node (sd)  [below=of sb]   {Service D};
    \end{scope}
\draw[-Stealth]
    ([ys= 1ex] sa.east)  edge ["send"]       ([ys= 1ex] sb.west)
    ([ys=-1ex] sb.west)  edge ["receive"]    ([ys=-1ex] sa.east)
    ([ys= 1ex] sc.east)  edge ["send"]       ([ys= 1ex] sd.west)
    ([ys=-1ex] sd.west)  edge ["receive"]    ([ys=-1ex] sc.east)
%
    ([xs= 1ex] sa.south)  edge ["receive"]       ([xs= 1ex] sc.north)
    ([xs=-1ex] sc.north)  edge ["send"]    ([xs=-1ex] sa.south)
    ([xs= 1ex] sb.south)  edge ["receive"]       ([xs= 1ex] sd.north)
    ([xs=-1ex] sd.north)   to  ["send"]    ([xs=-1ex] sb.south)
        ;
\end{tikzpicture}
\end{document}

second image:

enter image description here

    \documentclass[12pt, tikz, margin=3mm]{standalone}
    \usetikzlibrary{arrows.meta, positioning, quotes}

    \begin{document}
        \begin{tikzpicture}[
    node distance = 22mm and 22mm,
     mybox/.style = {draw, ultra thick,
                     text width=22mm, minimum height=11mm, align=center,
                     inner sep=2mm, outer sep=0mm},
every edge/.style = {draw, shorten >=2mm, shorten <=2mm,
                     bend left, -Stealth},
                            ]
        \begin{scope}[every node/.style={mybox}]
    \node (sa)                      {Service A};
    \node (sm)  [below right=of sa] {master};
    \node (sb)  [above right=of sm] {Service B};
    \node (sc)  [below left =of sm] {Service C};
    \node (sd)  [below right=of sm]  {Service D};
        \end{scope}
    \draw
        (sa)  edge  (sm)
        (sm)  edge  (sa)
        (sb)  edge  (sm)
        (sm)  edge  (sb)
        (sc)  edge  (sm)
        (sm)  edge  (sc)
        (sd)  edge  (sm)
        (sm)  edge  (sd)
        ;
    \end{tikzpicture}
    \end{document}
  • Thnks zarko . Second image is there in the attached image, just below the line. – Mishra S Aug 15 '17 at 19:41
  • @SibaMishra, for second image i need some time to upload it ... now the answer is complete (and corrected). – Zarko Aug 15 '17 at 19:50
4

enter image description here

Second picture: (You can adjust the angles if you want. This shows just proof of concept)

\documentclass[12pt,a4paper,twoside]{report}
\usepackage{tikz}
\usetikzlibrary{positioning}
\begin{document}
\begin{figure}
\centering


\begin{tikzpicture}[scale=0.5,
mybox/.style={
text width=2cm,
minimum height=3cm,
minimum width=2cm,
node distance=5cm,
align=center,
ultra thick,
draw},
myarrow/.style={
->,
>=stealth,
thick
}
]

\node [mybox](master){Master};
\node [mybox, above left =of master] (A){A};
\node [mybox, above right =of master] (B){B};
\node [mybox, below left =of master] (C){C};
\node [mybox, below right =of master] (D){D};

\draw [->,thick] (master) to [out=180, in=270] (A);
\draw [<-,thick] (master) to [out=90, in=0] (A);
\draw [->,thick] (master) to [out=90, in=180] (B);
\draw [<-,thick] (master) to [out=0, in=270] (B);
\draw [->,thick] (master) to [out=270, in=0] (C);
\draw [<-,thick] (master) to [out=180, in=90] (C);
\draw [->,thick] (master) to [out=0, in=90] (D);
\draw [<-,thick] (master) to [out=270, in=180] (D);


\end{tikzpicture}

\end{figure} 
\end{document}

alternatively you can use:

\draw [->,thick] (master) to [bend left=30] (A);
\draw [<-,thick] (master) to [bend right=30] (A);
\draw [->,thick] (master) to [bend left=30] (B);
\draw [<-,thick] (master) to [bend right=30] (B);
\draw [->,thick] (master) to [bend left=30] (C);
\draw [<-,thick] (master) to [bend right=30] (C);
\draw [->,thick] (master) to [bend left=30] (D);
\draw [<-,thick] (master) to [bend right=30] (D);
  • 1
    Thnk you Julian. – Mishra S Aug 15 '17 at 20:02

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.