Tkz-graph and foreach











up vote
3
down vote

favorite












I want to draw the following graph by using the usepackage tkz-graph and the command foreach or by any other method:
enter image description here



documentclass{article}
usepackage{amssymb,amsmath}
usepackage{xcolor}
usepackage{tkz-graph}

begin{document}

begin{tikzpicture}[rotate=-90]
GraphInit[vstyle=Classic]
SetVertexNoLabel
SetGraphUnit{1.5}
tikzset{VertexStyle/.append style={fill=black, minimum size=7pt, inner sep=1pt}}
Vertex{a}
SOEA(a){b}
NOEA(a){c}
EA(b){d}
EA(c){e}
Edges(b,d,e,c,a,b,c,e,b)
Edges(e,a,d,c)
end{tikzpicture}

end{document}









share|improve this question




























    up vote
    3
    down vote

    favorite












    I want to draw the following graph by using the usepackage tkz-graph and the command foreach or by any other method:
    enter image description here



    documentclass{article}
    usepackage{amssymb,amsmath}
    usepackage{xcolor}
    usepackage{tkz-graph}

    begin{document}

    begin{tikzpicture}[rotate=-90]
    GraphInit[vstyle=Classic]
    SetVertexNoLabel
    SetGraphUnit{1.5}
    tikzset{VertexStyle/.append style={fill=black, minimum size=7pt, inner sep=1pt}}
    Vertex{a}
    SOEA(a){b}
    NOEA(a){c}
    EA(b){d}
    EA(c){e}
    Edges(b,d,e,c,a,b,c,e,b)
    Edges(e,a,d,c)
    end{tikzpicture}

    end{document}









    share|improve this question


























      up vote
      3
      down vote

      favorite









      up vote
      3
      down vote

      favorite











      I want to draw the following graph by using the usepackage tkz-graph and the command foreach or by any other method:
      enter image description here



      documentclass{article}
      usepackage{amssymb,amsmath}
      usepackage{xcolor}
      usepackage{tkz-graph}

      begin{document}

      begin{tikzpicture}[rotate=-90]
      GraphInit[vstyle=Classic]
      SetVertexNoLabel
      SetGraphUnit{1.5}
      tikzset{VertexStyle/.append style={fill=black, minimum size=7pt, inner sep=1pt}}
      Vertex{a}
      SOEA(a){b}
      NOEA(a){c}
      EA(b){d}
      EA(c){e}
      Edges(b,d,e,c,a,b,c,e,b)
      Edges(e,a,d,c)
      end{tikzpicture}

      end{document}









      share|improve this question















      I want to draw the following graph by using the usepackage tkz-graph and the command foreach or by any other method:
      enter image description here



      documentclass{article}
      usepackage{amssymb,amsmath}
      usepackage{xcolor}
      usepackage{tkz-graph}

      begin{document}

      begin{tikzpicture}[rotate=-90]
      GraphInit[vstyle=Classic]
      SetVertexNoLabel
      SetGraphUnit{1.5}
      tikzset{VertexStyle/.append style={fill=black, minimum size=7pt, inner sep=1pt}}
      Vertex{a}
      SOEA(a){b}
      NOEA(a){c}
      EA(b){d}
      EA(c){e}
      Edges(b,d,e,c,a,b,c,e,b)
      Edges(e,a,d,c)
      end{tikzpicture}

      end{document}






      tikz-pgf tikz-graphs tkz-graph






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited 4 hours ago









      gusbrs

      6,8292839




      6,8292839










      asked 4 hours ago









      user105476

      967




      967






















          2 Answers
          2






          active

          oldest

          votes

















          up vote
          2
          down vote













          Solution with vanilla tikz



          documentclass[border = 5pt]{standalone}

          usepackage{tikz}
          usetikzlibrary{calc}

          begin{document}

          begin{tikzpicture}[
          node style/.style = {fill = black, minimum size = 7pt, circle},
          edge style/.style = {black, thick},
          ]

          % base
          foreach i in {0,...,4} {
          node[node style] (Ai) at ({2 * cos(72 * i)}, {2 * sin(72 * i)}) {};
          }

          % blocks
          foreach i [evaluate=j as j using {int(Mod(i + 1, 5))}] in {0,...,4} {

          % nodes, each block has nodes (A, B, C, D, E)
          node[node style] (Ci) at ($ (Ai)!2cm!-90:(Aj) $) {};
          node[node style] (Di) at ($ (Aj)!2cm!90:(Ai) $) {};
          coordinate (Ti) at ($ (Ci)!0.5!(Di) $);
          node[node style] (Ei) at ($ (Ti)!1.5cm!-90:(Di) $) {};

          % edges
          draw[edge style] (Ai) -- (Aj) -- (Ci) -- (Di) -- (Ai)
          -- (Ci) -- (Ei) -- (Di) -- (Aj) (Ai) -- (Ei) -- (Aj);

          }
          end{tikzpicture}

          end{document}


          enter image description here






          share|improve this answer




























            up vote
            1
            down vote













            Solution based on your graph and with foreach.



            documentclass{article}
            usepackage{amssymb,amsmath}
            usepackage{xcolor}
            usepackage{tkz-graph}

            begin{document}
            tikzset{pics/.cd,
            house/.style={code={
            Vertex{a}
            SOEA(a){b}
            NOEA(a){c}
            EA(b){d}
            EA(c){e}
            Edges(b,d,e,c,a,b,c,e,b)
            Edges(e,a,d,c)}}}
            begin{tikzpicture}
            GraphInit[vstyle=Classic]
            SetVertexNoLabel
            SetGraphUnit{1.5}
            tikzset{VertexStyle/.append style={fill=black, minimum size=7pt, inner sep=1pt}}
            foreach X in {0,72,...,288}
            {path (X-18:2.1) pic[rotate around={X+180-18:(3,0)}] {house};}
            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
              });


              }
              });














              draft saved

              draft discarded


















              StackExchange.ready(
              function () {
              StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f466293%2ftkz-graph-and-foreach%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
              2
              down vote













              Solution with vanilla tikz



              documentclass[border = 5pt]{standalone}

              usepackage{tikz}
              usetikzlibrary{calc}

              begin{document}

              begin{tikzpicture}[
              node style/.style = {fill = black, minimum size = 7pt, circle},
              edge style/.style = {black, thick},
              ]

              % base
              foreach i in {0,...,4} {
              node[node style] (Ai) at ({2 * cos(72 * i)}, {2 * sin(72 * i)}) {};
              }

              % blocks
              foreach i [evaluate=j as j using {int(Mod(i + 1, 5))}] in {0,...,4} {

              % nodes, each block has nodes (A, B, C, D, E)
              node[node style] (Ci) at ($ (Ai)!2cm!-90:(Aj) $) {};
              node[node style] (Di) at ($ (Aj)!2cm!90:(Ai) $) {};
              coordinate (Ti) at ($ (Ci)!0.5!(Di) $);
              node[node style] (Ei) at ($ (Ti)!1.5cm!-90:(Di) $) {};

              % edges
              draw[edge style] (Ai) -- (Aj) -- (Ci) -- (Di) -- (Ai)
              -- (Ci) -- (Ei) -- (Di) -- (Aj) (Ai) -- (Ei) -- (Aj);

              }
              end{tikzpicture}

              end{document}


              enter image description here






              share|improve this answer

























                up vote
                2
                down vote













                Solution with vanilla tikz



                documentclass[border = 5pt]{standalone}

                usepackage{tikz}
                usetikzlibrary{calc}

                begin{document}

                begin{tikzpicture}[
                node style/.style = {fill = black, minimum size = 7pt, circle},
                edge style/.style = {black, thick},
                ]

                % base
                foreach i in {0,...,4} {
                node[node style] (Ai) at ({2 * cos(72 * i)}, {2 * sin(72 * i)}) {};
                }

                % blocks
                foreach i [evaluate=j as j using {int(Mod(i + 1, 5))}] in {0,...,4} {

                % nodes, each block has nodes (A, B, C, D, E)
                node[node style] (Ci) at ($ (Ai)!2cm!-90:(Aj) $) {};
                node[node style] (Di) at ($ (Aj)!2cm!90:(Ai) $) {};
                coordinate (Ti) at ($ (Ci)!0.5!(Di) $);
                node[node style] (Ei) at ($ (Ti)!1.5cm!-90:(Di) $) {};

                % edges
                draw[edge style] (Ai) -- (Aj) -- (Ci) -- (Di) -- (Ai)
                -- (Ci) -- (Ei) -- (Di) -- (Aj) (Ai) -- (Ei) -- (Aj);

                }
                end{tikzpicture}

                end{document}


                enter image description here






                share|improve this answer























                  up vote
                  2
                  down vote










                  up vote
                  2
                  down vote









                  Solution with vanilla tikz



                  documentclass[border = 5pt]{standalone}

                  usepackage{tikz}
                  usetikzlibrary{calc}

                  begin{document}

                  begin{tikzpicture}[
                  node style/.style = {fill = black, minimum size = 7pt, circle},
                  edge style/.style = {black, thick},
                  ]

                  % base
                  foreach i in {0,...,4} {
                  node[node style] (Ai) at ({2 * cos(72 * i)}, {2 * sin(72 * i)}) {};
                  }

                  % blocks
                  foreach i [evaluate=j as j using {int(Mod(i + 1, 5))}] in {0,...,4} {

                  % nodes, each block has nodes (A, B, C, D, E)
                  node[node style] (Ci) at ($ (Ai)!2cm!-90:(Aj) $) {};
                  node[node style] (Di) at ($ (Aj)!2cm!90:(Ai) $) {};
                  coordinate (Ti) at ($ (Ci)!0.5!(Di) $);
                  node[node style] (Ei) at ($ (Ti)!1.5cm!-90:(Di) $) {};

                  % edges
                  draw[edge style] (Ai) -- (Aj) -- (Ci) -- (Di) -- (Ai)
                  -- (Ci) -- (Ei) -- (Di) -- (Aj) (Ai) -- (Ei) -- (Aj);

                  }
                  end{tikzpicture}

                  end{document}


                  enter image description here






                  share|improve this answer












                  Solution with vanilla tikz



                  documentclass[border = 5pt]{standalone}

                  usepackage{tikz}
                  usetikzlibrary{calc}

                  begin{document}

                  begin{tikzpicture}[
                  node style/.style = {fill = black, minimum size = 7pt, circle},
                  edge style/.style = {black, thick},
                  ]

                  % base
                  foreach i in {0,...,4} {
                  node[node style] (Ai) at ({2 * cos(72 * i)}, {2 * sin(72 * i)}) {};
                  }

                  % blocks
                  foreach i [evaluate=j as j using {int(Mod(i + 1, 5))}] in {0,...,4} {

                  % nodes, each block has nodes (A, B, C, D, E)
                  node[node style] (Ci) at ($ (Ai)!2cm!-90:(Aj) $) {};
                  node[node style] (Di) at ($ (Aj)!2cm!90:(Ai) $) {};
                  coordinate (Ti) at ($ (Ci)!0.5!(Di) $);
                  node[node style] (Ei) at ($ (Ti)!1.5cm!-90:(Di) $) {};

                  % edges
                  draw[edge style] (Ai) -- (Aj) -- (Ci) -- (Di) -- (Ai)
                  -- (Ci) -- (Ei) -- (Di) -- (Aj) (Ai) -- (Ei) -- (Aj);

                  }
                  end{tikzpicture}

                  end{document}


                  enter image description here







                  share|improve this answer












                  share|improve this answer



                  share|improve this answer










                  answered 1 hour ago









                  caverac

                  4,6381521




                  4,6381521






















                      up vote
                      1
                      down vote













                      Solution based on your graph and with foreach.



                      documentclass{article}
                      usepackage{amssymb,amsmath}
                      usepackage{xcolor}
                      usepackage{tkz-graph}

                      begin{document}
                      tikzset{pics/.cd,
                      house/.style={code={
                      Vertex{a}
                      SOEA(a){b}
                      NOEA(a){c}
                      EA(b){d}
                      EA(c){e}
                      Edges(b,d,e,c,a,b,c,e,b)
                      Edges(e,a,d,c)}}}
                      begin{tikzpicture}
                      GraphInit[vstyle=Classic]
                      SetVertexNoLabel
                      SetGraphUnit{1.5}
                      tikzset{VertexStyle/.append style={fill=black, minimum size=7pt, inner sep=1pt}}
                      foreach X in {0,72,...,288}
                      {path (X-18:2.1) pic[rotate around={X+180-18:(3,0)}] {house};}
                      end{tikzpicture}
                      end{document}


                      enter image description here






                      share|improve this answer

























                        up vote
                        1
                        down vote













                        Solution based on your graph and with foreach.



                        documentclass{article}
                        usepackage{amssymb,amsmath}
                        usepackage{xcolor}
                        usepackage{tkz-graph}

                        begin{document}
                        tikzset{pics/.cd,
                        house/.style={code={
                        Vertex{a}
                        SOEA(a){b}
                        NOEA(a){c}
                        EA(b){d}
                        EA(c){e}
                        Edges(b,d,e,c,a,b,c,e,b)
                        Edges(e,a,d,c)}}}
                        begin{tikzpicture}
                        GraphInit[vstyle=Classic]
                        SetVertexNoLabel
                        SetGraphUnit{1.5}
                        tikzset{VertexStyle/.append style={fill=black, minimum size=7pt, inner sep=1pt}}
                        foreach X in {0,72,...,288}
                        {path (X-18:2.1) pic[rotate around={X+180-18:(3,0)}] {house};}
                        end{tikzpicture}
                        end{document}


                        enter image description here






                        share|improve this answer























                          up vote
                          1
                          down vote










                          up vote
                          1
                          down vote









                          Solution based on your graph and with foreach.



                          documentclass{article}
                          usepackage{amssymb,amsmath}
                          usepackage{xcolor}
                          usepackage{tkz-graph}

                          begin{document}
                          tikzset{pics/.cd,
                          house/.style={code={
                          Vertex{a}
                          SOEA(a){b}
                          NOEA(a){c}
                          EA(b){d}
                          EA(c){e}
                          Edges(b,d,e,c,a,b,c,e,b)
                          Edges(e,a,d,c)}}}
                          begin{tikzpicture}
                          GraphInit[vstyle=Classic]
                          SetVertexNoLabel
                          SetGraphUnit{1.5}
                          tikzset{VertexStyle/.append style={fill=black, minimum size=7pt, inner sep=1pt}}
                          foreach X in {0,72,...,288}
                          {path (X-18:2.1) pic[rotate around={X+180-18:(3,0)}] {house};}
                          end{tikzpicture}
                          end{document}


                          enter image description here






                          share|improve this answer












                          Solution based on your graph and with foreach.



                          documentclass{article}
                          usepackage{amssymb,amsmath}
                          usepackage{xcolor}
                          usepackage{tkz-graph}

                          begin{document}
                          tikzset{pics/.cd,
                          house/.style={code={
                          Vertex{a}
                          SOEA(a){b}
                          NOEA(a){c}
                          EA(b){d}
                          EA(c){e}
                          Edges(b,d,e,c,a,b,c,e,b)
                          Edges(e,a,d,c)}}}
                          begin{tikzpicture}
                          GraphInit[vstyle=Classic]
                          SetVertexNoLabel
                          SetGraphUnit{1.5}
                          tikzset{VertexStyle/.append style={fill=black, minimum size=7pt, inner sep=1pt}}
                          foreach X in {0,72,...,288}
                          {path (X-18:2.1) pic[rotate around={X+180-18:(3,0)}] {house};}
                          end{tikzpicture}
                          end{document}


                          enter image description here







                          share|improve this answer












                          share|improve this answer



                          share|improve this answer










                          answered 1 hour ago









                          marmot

                          83.8k493178




                          83.8k493178






























                              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%2f466293%2ftkz-graph-and-foreach%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

                              404 Error Contact Form 7 ajax form submitting

                              How to know if a Active Directory user can login interactively

                              Refactoring coordinates for Minecraft Pi buildings written in Python