Is it possible to draw this network using Tikz?











up vote
4
down vote

favorite












I'm trying to draw networks like network in the figure below.
I can draw similar networks using tokens, nodes and edges but the problem is that I can only connect nodes by edges.



What I need is to connect tokens inside nodes by edges like the figure below: (In this example, node R has two tokens. One of them is connected to node A and the other is connected to node B.)



Is it possible to achieve this using Tikz?



network



Here is what I tried so far:



begin{tikzpicture}[node distance=1.5cm] 
begin{scope}
node [place,tokens=1](0)[label=below:$A$]{};
node [place,tokens=2] (1) [right of=0,label=below:$R$] {} edge (0);
node [place,tokens=1] (2) [right of=1,label=below:$B$] {} edge (1);
end{scope}
end{tikzpicture}









share|improve this question




















  • 2




    welcome to tex.se! yes, it is possible to draw this figure :-). what you try so far? please show us this!
    – Zarko
    Nov 28 at 22:43










  • Thanks :) Here is what I tried so far: begin{tikzpicture}[node distance=1.5cm] begin{scope} node [place,tokens=1](0)[label=below:$A$]{}; node [place,tokens=2] (1) [right of=0,label=below:$R$] {} edge (0); node [place,tokens=1] (2) [right of=1,label=below:$B$] {} edge (1); end{scope} end{tikzpicture}
    – itechi
    Nov 28 at 22:45

















up vote
4
down vote

favorite












I'm trying to draw networks like network in the figure below.
I can draw similar networks using tokens, nodes and edges but the problem is that I can only connect nodes by edges.



What I need is to connect tokens inside nodes by edges like the figure below: (In this example, node R has two tokens. One of them is connected to node A and the other is connected to node B.)



Is it possible to achieve this using Tikz?



network



Here is what I tried so far:



begin{tikzpicture}[node distance=1.5cm] 
begin{scope}
node [place,tokens=1](0)[label=below:$A$]{};
node [place,tokens=2] (1) [right of=0,label=below:$R$] {} edge (0);
node [place,tokens=1] (2) [right of=1,label=below:$B$] {} edge (1);
end{scope}
end{tikzpicture}









share|improve this question




















  • 2




    welcome to tex.se! yes, it is possible to draw this figure :-). what you try so far? please show us this!
    – Zarko
    Nov 28 at 22:43










  • Thanks :) Here is what I tried so far: begin{tikzpicture}[node distance=1.5cm] begin{scope} node [place,tokens=1](0)[label=below:$A$]{}; node [place,tokens=2] (1) [right of=0,label=below:$R$] {} edge (0); node [place,tokens=1] (2) [right of=1,label=below:$B$] {} edge (1); end{scope} end{tikzpicture}
    – itechi
    Nov 28 at 22:45















up vote
4
down vote

favorite









up vote
4
down vote

favorite











I'm trying to draw networks like network in the figure below.
I can draw similar networks using tokens, nodes and edges but the problem is that I can only connect nodes by edges.



What I need is to connect tokens inside nodes by edges like the figure below: (In this example, node R has two tokens. One of them is connected to node A and the other is connected to node B.)



Is it possible to achieve this using Tikz?



network



Here is what I tried so far:



begin{tikzpicture}[node distance=1.5cm] 
begin{scope}
node [place,tokens=1](0)[label=below:$A$]{};
node [place,tokens=2] (1) [right of=0,label=below:$R$] {} edge (0);
node [place,tokens=1] (2) [right of=1,label=below:$B$] {} edge (1);
end{scope}
end{tikzpicture}









share|improve this question















I'm trying to draw networks like network in the figure below.
I can draw similar networks using tokens, nodes and edges but the problem is that I can only connect nodes by edges.



What I need is to connect tokens inside nodes by edges like the figure below: (In this example, node R has two tokens. One of them is connected to node A and the other is connected to node B.)



Is it possible to achieve this using Tikz?



network



Here is what I tried so far:



begin{tikzpicture}[node distance=1.5cm] 
begin{scope}
node [place,tokens=1](0)[label=below:$A$]{};
node [place,tokens=2] (1) [right of=0,label=below:$R$] {} edge (0);
node [place,tokens=1] (2) [right of=1,label=below:$B$] {} edge (1);
end{scope}
end{tikzpicture}






tikz-pgf






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 28 at 22:49









CarLaTeX

28.8k447123




28.8k447123










asked Nov 28 at 22:39









itechi

232




232








  • 2




    welcome to tex.se! yes, it is possible to draw this figure :-). what you try so far? please show us this!
    – Zarko
    Nov 28 at 22:43










  • Thanks :) Here is what I tried so far: begin{tikzpicture}[node distance=1.5cm] begin{scope} node [place,tokens=1](0)[label=below:$A$]{}; node [place,tokens=2] (1) [right of=0,label=below:$R$] {} edge (0); node [place,tokens=1] (2) [right of=1,label=below:$B$] {} edge (1); end{scope} end{tikzpicture}
    – itechi
    Nov 28 at 22:45
















  • 2




    welcome to tex.se! yes, it is possible to draw this figure :-). what you try so far? please show us this!
    – Zarko
    Nov 28 at 22:43










  • Thanks :) Here is what I tried so far: begin{tikzpicture}[node distance=1.5cm] begin{scope} node [place,tokens=1](0)[label=below:$A$]{}; node [place,tokens=2] (1) [right of=0,label=below:$R$] {} edge (0); node [place,tokens=1] (2) [right of=1,label=below:$B$] {} edge (1); end{scope} end{tikzpicture}
    – itechi
    Nov 28 at 22:45










2




2




welcome to tex.se! yes, it is possible to draw this figure :-). what you try so far? please show us this!
– Zarko
Nov 28 at 22:43




welcome to tex.se! yes, it is possible to draw this figure :-). what you try so far? please show us this!
– Zarko
Nov 28 at 22:43












Thanks :) Here is what I tried so far: begin{tikzpicture}[node distance=1.5cm] begin{scope} node [place,tokens=1](0)[label=below:$A$]{}; node [place,tokens=2] (1) [right of=0,label=below:$R$] {} edge (0); node [place,tokens=1] (2) [right of=1,label=below:$B$] {} edge (1); end{scope} end{tikzpicture}
– itechi
Nov 28 at 22:45






Thanks :) Here is what I tried so far: begin{tikzpicture}[node distance=1.5cm] begin{scope} node [place,tokens=1](0)[label=below:$A$]{}; node [place,tokens=2] (1) [right of=0,label=below:$R$] {} edge (0); node [place,tokens=1] (2) [right of=1,label=below:$B$] {} edge (1); end{scope} end{tikzpicture}
– itechi
Nov 28 at 22:45












2 Answers
2






active

oldest

votes

















up vote
6
down vote



accepted










One of many possible methods:



enter image description here



documentclass[border=5mm]{standalone}
usepackage{tikz}
usetikzlibrary{positioning, fit}
begin{document}
begin{tikzpicture}[
dot/.style={fill,circle, minimum size=5pt,inner sep=0,node contents={}},
circ/.style={draw, circle, minimum size=10pt,inner sep=0pt, node contents={}}
]

node [dot, name=n1];
node [dot, name=n2, right=of n1];
node [dot, name=n3, right=5mm of n2];
node [dot, name=n4, right=of n3];

draw (n1) -- (n2) (n3) -- (n4);

node [circ,fit=(n2)(n3), label={[name=R]below:R}];
node [circ, left, at=(n1.east), name=A];
node [circ, right, at=(n4.west), name=B];

node at (A |- R) {A};
node at (B |- R) {B};
end{tikzpicture}
end{document}





share|improve this answer




























    up vote
    5
    down vote













    Simply using the arrows.meta library, the Circle tip can be used and customized as you want, e.g, >={Circle[length=5pt]}, shorten >= -5pt, shorten <= -5pt will use a 5pt filled circle and will also lengthen the line by the same amount in both sides. If you want the tip touch the circle from inside, just subtract another pgflinewidth from the above.



    documentclass[tikz,12pt]{standalone}
    usetikzlibrary{arrows.meta}
    begin{document}

    begin{tikzpicture}[>={Circle[length=5pt]}, shorten >= -5pt-pgflinewidth, shorten <= -5pt-pgflinewidth]

    node(a) at (0,0) [draw,circle,minimum size=.5cm]{};
    node(r) at (2,0) [draw,circle,minimum size=1cm]{};
    node(b) at (4,0) [draw,circle,minimum size=.5cm]{};

    node at ([yshift=-2em]a) {A};
    node at ([yshift=-2em]r) {R};
    node at ([yshift=-2em]b) {B};

    draw[<->] (a) -- (r);
    draw[<->] (r) -- (b);

    end{tikzpicture}

    end{document



    enter image description here







    share|improve this answer























      Your Answer








      StackExchange.ready(function() {
      var channelOptions = {
      tags: "".split(" "),
      id: "85"
      };
      initTagRenderer("".split(" "), "".split(" "), channelOptions);

      StackExchange.using("externalEditor", function() {
      // Have to fire editor after snippets, if snippets enabled
      if (StackExchange.settings.snippets.snippetsEnabled) {
      StackExchange.using("snippets", function() {
      createEditor();
      });
      }
      else {
      createEditor();
      }
      });

      function createEditor() {
      StackExchange.prepareEditor({
      heartbeatType: 'answer',
      autoActivateHeartbeat: false,
      convertImagesToLinks: false,
      noModals: true,
      showLowRepImageUploadWarning: true,
      reputationToPostImages: null,
      bindNavPrevention: true,
      postfix: "",
      imageUploader: {
      brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
      contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
      allowUrls: true
      },
      onDemand: true,
      discardSelector: ".discard-answer"
      ,immediatelyShowMarkdownHelp:true
      });


      }
      });














      draft saved

      draft discarded


















      StackExchange.ready(
      function () {
      StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f462269%2fis-it-possible-to-draw-this-network-using-tikz%23new-answer', 'question_page');
      }
      );

      Post as a guest















      Required, but never shown

























      2 Answers
      2






      active

      oldest

      votes








      2 Answers
      2






      active

      oldest

      votes









      active

      oldest

      votes






      active

      oldest

      votes








      up vote
      6
      down vote



      accepted










      One of many possible methods:



      enter image description here



      documentclass[border=5mm]{standalone}
      usepackage{tikz}
      usetikzlibrary{positioning, fit}
      begin{document}
      begin{tikzpicture}[
      dot/.style={fill,circle, minimum size=5pt,inner sep=0,node contents={}},
      circ/.style={draw, circle, minimum size=10pt,inner sep=0pt, node contents={}}
      ]

      node [dot, name=n1];
      node [dot, name=n2, right=of n1];
      node [dot, name=n3, right=5mm of n2];
      node [dot, name=n4, right=of n3];

      draw (n1) -- (n2) (n3) -- (n4);

      node [circ,fit=(n2)(n3), label={[name=R]below:R}];
      node [circ, left, at=(n1.east), name=A];
      node [circ, right, at=(n4.west), name=B];

      node at (A |- R) {A};
      node at (B |- R) {B};
      end{tikzpicture}
      end{document}





      share|improve this answer

























        up vote
        6
        down vote



        accepted










        One of many possible methods:



        enter image description here



        documentclass[border=5mm]{standalone}
        usepackage{tikz}
        usetikzlibrary{positioning, fit}
        begin{document}
        begin{tikzpicture}[
        dot/.style={fill,circle, minimum size=5pt,inner sep=0,node contents={}},
        circ/.style={draw, circle, minimum size=10pt,inner sep=0pt, node contents={}}
        ]

        node [dot, name=n1];
        node [dot, name=n2, right=of n1];
        node [dot, name=n3, right=5mm of n2];
        node [dot, name=n4, right=of n3];

        draw (n1) -- (n2) (n3) -- (n4);

        node [circ,fit=(n2)(n3), label={[name=R]below:R}];
        node [circ, left, at=(n1.east), name=A];
        node [circ, right, at=(n4.west), name=B];

        node at (A |- R) {A};
        node at (B |- R) {B};
        end{tikzpicture}
        end{document}





        share|improve this answer























          up vote
          6
          down vote



          accepted







          up vote
          6
          down vote



          accepted






          One of many possible methods:



          enter image description here



          documentclass[border=5mm]{standalone}
          usepackage{tikz}
          usetikzlibrary{positioning, fit}
          begin{document}
          begin{tikzpicture}[
          dot/.style={fill,circle, minimum size=5pt,inner sep=0,node contents={}},
          circ/.style={draw, circle, minimum size=10pt,inner sep=0pt, node contents={}}
          ]

          node [dot, name=n1];
          node [dot, name=n2, right=of n1];
          node [dot, name=n3, right=5mm of n2];
          node [dot, name=n4, right=of n3];

          draw (n1) -- (n2) (n3) -- (n4);

          node [circ,fit=(n2)(n3), label={[name=R]below:R}];
          node [circ, left, at=(n1.east), name=A];
          node [circ, right, at=(n4.west), name=B];

          node at (A |- R) {A};
          node at (B |- R) {B};
          end{tikzpicture}
          end{document}





          share|improve this answer












          One of many possible methods:



          enter image description here



          documentclass[border=5mm]{standalone}
          usepackage{tikz}
          usetikzlibrary{positioning, fit}
          begin{document}
          begin{tikzpicture}[
          dot/.style={fill,circle, minimum size=5pt,inner sep=0,node contents={}},
          circ/.style={draw, circle, minimum size=10pt,inner sep=0pt, node contents={}}
          ]

          node [dot, name=n1];
          node [dot, name=n2, right=of n1];
          node [dot, name=n3, right=5mm of n2];
          node [dot, name=n4, right=of n3];

          draw (n1) -- (n2) (n3) -- (n4);

          node [circ,fit=(n2)(n3), label={[name=R]below:R}];
          node [circ, left, at=(n1.east), name=A];
          node [circ, right, at=(n4.west), name=B];

          node at (A |- R) {A};
          node at (B |- R) {B};
          end{tikzpicture}
          end{document}






          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Nov 28 at 22:52









          Torbjørn T.

          154k13245434




          154k13245434






















              up vote
              5
              down vote













              Simply using the arrows.meta library, the Circle tip can be used and customized as you want, e.g, >={Circle[length=5pt]}, shorten >= -5pt, shorten <= -5pt will use a 5pt filled circle and will also lengthen the line by the same amount in both sides. If you want the tip touch the circle from inside, just subtract another pgflinewidth from the above.



              documentclass[tikz,12pt]{standalone}
              usetikzlibrary{arrows.meta}
              begin{document}

              begin{tikzpicture}[>={Circle[length=5pt]}, shorten >= -5pt-pgflinewidth, shorten <= -5pt-pgflinewidth]

              node(a) at (0,0) [draw,circle,minimum size=.5cm]{};
              node(r) at (2,0) [draw,circle,minimum size=1cm]{};
              node(b) at (4,0) [draw,circle,minimum size=.5cm]{};

              node at ([yshift=-2em]a) {A};
              node at ([yshift=-2em]r) {R};
              node at ([yshift=-2em]b) {B};

              draw[<->] (a) -- (r);
              draw[<->] (r) -- (b);

              end{tikzpicture}

              end{document



              enter image description here







              share|improve this answer



























                up vote
                5
                down vote













                Simply using the arrows.meta library, the Circle tip can be used and customized as you want, e.g, >={Circle[length=5pt]}, shorten >= -5pt, shorten <= -5pt will use a 5pt filled circle and will also lengthen the line by the same amount in both sides. If you want the tip touch the circle from inside, just subtract another pgflinewidth from the above.



                documentclass[tikz,12pt]{standalone}
                usetikzlibrary{arrows.meta}
                begin{document}

                begin{tikzpicture}[>={Circle[length=5pt]}, shorten >= -5pt-pgflinewidth, shorten <= -5pt-pgflinewidth]

                node(a) at (0,0) [draw,circle,minimum size=.5cm]{};
                node(r) at (2,0) [draw,circle,minimum size=1cm]{};
                node(b) at (4,0) [draw,circle,minimum size=.5cm]{};

                node at ([yshift=-2em]a) {A};
                node at ([yshift=-2em]r) {R};
                node at ([yshift=-2em]b) {B};

                draw[<->] (a) -- (r);
                draw[<->] (r) -- (b);

                end{tikzpicture}

                end{document



                enter image description here







                share|improve this answer

























                  up vote
                  5
                  down vote










                  up vote
                  5
                  down vote









                  Simply using the arrows.meta library, the Circle tip can be used and customized as you want, e.g, >={Circle[length=5pt]}, shorten >= -5pt, shorten <= -5pt will use a 5pt filled circle and will also lengthen the line by the same amount in both sides. If you want the tip touch the circle from inside, just subtract another pgflinewidth from the above.



                  documentclass[tikz,12pt]{standalone}
                  usetikzlibrary{arrows.meta}
                  begin{document}

                  begin{tikzpicture}[>={Circle[length=5pt]}, shorten >= -5pt-pgflinewidth, shorten <= -5pt-pgflinewidth]

                  node(a) at (0,0) [draw,circle,minimum size=.5cm]{};
                  node(r) at (2,0) [draw,circle,minimum size=1cm]{};
                  node(b) at (4,0) [draw,circle,minimum size=.5cm]{};

                  node at ([yshift=-2em]a) {A};
                  node at ([yshift=-2em]r) {R};
                  node at ([yshift=-2em]b) {B};

                  draw[<->] (a) -- (r);
                  draw[<->] (r) -- (b);

                  end{tikzpicture}

                  end{document



                  enter image description here







                  share|improve this answer














                  Simply using the arrows.meta library, the Circle tip can be used and customized as you want, e.g, >={Circle[length=5pt]}, shorten >= -5pt, shorten <= -5pt will use a 5pt filled circle and will also lengthen the line by the same amount in both sides. If you want the tip touch the circle from inside, just subtract another pgflinewidth from the above.



                  documentclass[tikz,12pt]{standalone}
                  usetikzlibrary{arrows.meta}
                  begin{document}

                  begin{tikzpicture}[>={Circle[length=5pt]}, shorten >= -5pt-pgflinewidth, shorten <= -5pt-pgflinewidth]

                  node(a) at (0,0) [draw,circle,minimum size=.5cm]{};
                  node(r) at (2,0) [draw,circle,minimum size=1cm]{};
                  node(b) at (4,0) [draw,circle,minimum size=.5cm]{};

                  node at ([yshift=-2em]a) {A};
                  node at ([yshift=-2em]r) {R};
                  node at ([yshift=-2em]b) {B};

                  draw[<->] (a) -- (r);
                  draw[<->] (r) -- (b);

                  end{tikzpicture}

                  end{document



                  enter image description here








                  share|improve this answer














                  share|improve this answer



                  share|improve this answer








                  edited Nov 28 at 23:48

























                  answered Nov 28 at 23:34









                  AboAmmar

                  32.2k22781




                  32.2k22781






























                      draft saved

                      draft discarded




















































                      Thanks for contributing an answer to TeX - LaTeX Stack Exchange!


                      • Please be sure to answer the question. Provide details and share your research!

                      But avoid



                      • Asking for help, clarification, or responding to other answers.

                      • Making statements based on opinion; back them up with references or personal experience.


                      To learn more, see our tips on writing great answers.





                      Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


                      Please pay close attention to the following guidance:


                      • Please be sure to answer the question. Provide details and share your research!

                      But avoid



                      • Asking for help, clarification, or responding to other answers.

                      • Making statements based on opinion; back them up with references or personal experience.


                      To learn more, see our tips on writing great answers.




                      draft saved


                      draft discarded














                      StackExchange.ready(
                      function () {
                      StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f462269%2fis-it-possible-to-draw-this-network-using-tikz%23new-answer', 'question_page');
                      }
                      );

                      Post as a guest















                      Required, but never shown





















































                      Required, but never shown














                      Required, but never shown












                      Required, but never shown







                      Required, but never shown

































                      Required, but never shown














                      Required, but never shown












                      Required, but never shown







                      Required, but never shown







                      Popular posts from this blog

                      Сан-Квентин

                      8-я гвардейская общевойсковая армия

                      Алькесар