Is it possible to draw this network using Tikz?











up vote
3
down vote

favorite
1












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









New contributor




itechi is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
















  • 2




    welcome to tex.se! yes, it is possible to draw this figure :-). what you try so far? please show us this!
    – Zarko
    6 hours ago










  • 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
    6 hours ago

















up vote
3
down vote

favorite
1












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









New contributor




itechi is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
















  • 2




    welcome to tex.se! yes, it is possible to draw this figure :-). what you try so far? please show us this!
    – Zarko
    6 hours ago










  • 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
    6 hours ago















up vote
3
down vote

favorite
1









up vote
3
down vote

favorite
1






1





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









New contributor




itechi is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.











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









New contributor




itechi is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.











share|improve this question









New contributor




itechi is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.









share|improve this question




share|improve this question








edited 6 hours ago









CarLaTeX

27.5k445120




27.5k445120






New contributor




itechi is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.









asked 6 hours ago









itechi

182




182




New contributor




itechi is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.





New contributor





itechi is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.






itechi is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.








  • 2




    welcome to tex.se! yes, it is possible to draw this figure :-). what you try so far? please show us this!
    – Zarko
    6 hours ago










  • 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
    6 hours ago
















  • 2




    welcome to tex.se! yes, it is possible to draw this figure :-). what you try so far? please show us this!
    – Zarko
    6 hours ago










  • 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
    6 hours ago










2




2




welcome to tex.se! yes, it is possible to draw this figure :-). what you try so far? please show us this!
– Zarko
6 hours ago




welcome to tex.se! yes, it is possible to draw this figure :-). what you try so far? please show us this!
– Zarko
6 hours ago












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
6 hours ago






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
6 hours ago












2 Answers
2






active

oldest

votes

















up vote
5
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
    2
    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',
      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
      });


      }
      });






      itechi is a new contributor. Be nice, and check out our Code of Conduct.










       

      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
      5
      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



        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



          accepted







          up vote
          5
          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 6 hours ago









          Torbjørn T.

          153k13245433




          153k13245433






















              up vote
              2
              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
                2
                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
                  2
                  down vote










                  up vote
                  2
                  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 5 hours ago

























                  answered 5 hours ago









                  AboAmmar

                  31.5k22781




                  31.5k22781






















                      itechi is a new contributor. Be nice, and check out our Code of Conduct.










                       

                      draft saved


                      draft discarded


















                      itechi is a new contributor. Be nice, and check out our Code of Conduct.













                      itechi is a new contributor. Be nice, and check out our Code of Conduct.












                      itechi is a new contributor. Be nice, and check out our Code of Conduct.















                       


                      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

                      Accessing regular linux commands in Huawei's Dopra Linux

                      Can't connect RFCOMM socket: Host is down

                      Kernel panic - not syncing: Fatal Exception in Interrupt