How to draw this directed graph with tikz












1















I am new using Tikz, and I am trying to know how to draw graphs, my try is:



documentclass[11pt]{article}

usepackage{tikz}


begin{document}

begin{tikzpicture}[y=.4cm, x=.4cm,font=normalsize]
draw (0,5) -- (1,2);
draw (1,2) -- (2.3,0.42) ;
draw (5,0) -- (2.3,0.42) ;
draw (9,2) -- (10,5);
draw (7.3,9.4) -- (5,10);
draw (9,8) -- (7.3,9.4);
draw (10,5) -- (9,8);
draw (5,10) -- (2.3,9.4);
draw (0,5) -- (0.7,7);
draw (0.9,7.7) -- (2.3,9.5);
draw (5,0) -- (7.3,0.42);
draw (7.3,0.42) -- (9,2);
filldraw[fill=black!40,draw=black!80] (0,5) circle (2pt) node[anchor=east] {10};
filldraw[fill=black!40,draw=black!80] (5,0) circle (2pt) node[anchor=north] {7};
filldraw[fill=black!40,draw=black!80] (5,10) circle (2pt) node[anchor=south] {1};
filldraw[fill=black!40,draw=black!80] (10,5) circle (2pt)node[anchor=west] {4};
filldraw[fill=black!40,draw=black!80] (9,2) circle (2pt) node[anchor=west] {5};
filldraw[fill=black!40,draw=black!80] (9,8) circle (2pt) node[anchor=west] {3};
filldraw[fill=black!40,draw=black!80] (1,2) circle (2pt) node[anchor=east] {9};
filldraw[fill=black!40,draw=black!80] (7.3,0.42) circle (2pt) node[anchor=west] {6};
filldraw[fill=black!40,draw=black!80] (7.3,9.4) circle (2pt) node[anchor=west] {2};
filldraw[fill=black!40,draw=black!80] (2.3,9.4) circle (2pt) node[anchor=south] {n};
filldraw[fill=black!40,draw=black!80] (2.3,0.42) circle (2pt) node[anchor=north] {8};
filldraw[fill=white!40,draw=white!80] (1.7,7.5) circle (2pt) node[anchor=east] {dots};

end{tikzpicture}

end{document}


and it gives me something similar to what I want, but I only need that the graph is directed but when I put something like:



draw [->](7.3,9.4)  --  (5,10);


It allways give errors. I have tryied to install other packages and user other compilators (TeXworks,TeXmaker and Overleaf) but I haven't managed to fix this. Please help.










share|improve this question









New contributor




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





















  • Welcome to TeX.SE! The errors may come from [...] instead of [...], i.e. try draw [->](7.3,9.4) -- (5,10);. Yet you can simplify the graph a lot.

    – marmot
    4 mins ago











  • Yes! I know it can be simplified a lot, I am new at this and trying to learn. Actually it worked with draw [ latex-]

    – J.Rodriguez
    15 secs ago
















1















I am new using Tikz, and I am trying to know how to draw graphs, my try is:



documentclass[11pt]{article}

usepackage{tikz}


begin{document}

begin{tikzpicture}[y=.4cm, x=.4cm,font=normalsize]
draw (0,5) -- (1,2);
draw (1,2) -- (2.3,0.42) ;
draw (5,0) -- (2.3,0.42) ;
draw (9,2) -- (10,5);
draw (7.3,9.4) -- (5,10);
draw (9,8) -- (7.3,9.4);
draw (10,5) -- (9,8);
draw (5,10) -- (2.3,9.4);
draw (0,5) -- (0.7,7);
draw (0.9,7.7) -- (2.3,9.5);
draw (5,0) -- (7.3,0.42);
draw (7.3,0.42) -- (9,2);
filldraw[fill=black!40,draw=black!80] (0,5) circle (2pt) node[anchor=east] {10};
filldraw[fill=black!40,draw=black!80] (5,0) circle (2pt) node[anchor=north] {7};
filldraw[fill=black!40,draw=black!80] (5,10) circle (2pt) node[anchor=south] {1};
filldraw[fill=black!40,draw=black!80] (10,5) circle (2pt)node[anchor=west] {4};
filldraw[fill=black!40,draw=black!80] (9,2) circle (2pt) node[anchor=west] {5};
filldraw[fill=black!40,draw=black!80] (9,8) circle (2pt) node[anchor=west] {3};
filldraw[fill=black!40,draw=black!80] (1,2) circle (2pt) node[anchor=east] {9};
filldraw[fill=black!40,draw=black!80] (7.3,0.42) circle (2pt) node[anchor=west] {6};
filldraw[fill=black!40,draw=black!80] (7.3,9.4) circle (2pt) node[anchor=west] {2};
filldraw[fill=black!40,draw=black!80] (2.3,9.4) circle (2pt) node[anchor=south] {n};
filldraw[fill=black!40,draw=black!80] (2.3,0.42) circle (2pt) node[anchor=north] {8};
filldraw[fill=white!40,draw=white!80] (1.7,7.5) circle (2pt) node[anchor=east] {dots};

end{tikzpicture}

end{document}


and it gives me something similar to what I want, but I only need that the graph is directed but when I put something like:



draw [->](7.3,9.4)  --  (5,10);


It allways give errors. I have tryied to install other packages and user other compilators (TeXworks,TeXmaker and Overleaf) but I haven't managed to fix this. Please help.










share|improve this question









New contributor




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





















  • Welcome to TeX.SE! The errors may come from [...] instead of [...], i.e. try draw [->](7.3,9.4) -- (5,10);. Yet you can simplify the graph a lot.

    – marmot
    4 mins ago











  • Yes! I know it can be simplified a lot, I am new at this and trying to learn. Actually it worked with draw [ latex-]

    – J.Rodriguez
    15 secs ago














1












1








1








I am new using Tikz, and I am trying to know how to draw graphs, my try is:



documentclass[11pt]{article}

usepackage{tikz}


begin{document}

begin{tikzpicture}[y=.4cm, x=.4cm,font=normalsize]
draw (0,5) -- (1,2);
draw (1,2) -- (2.3,0.42) ;
draw (5,0) -- (2.3,0.42) ;
draw (9,2) -- (10,5);
draw (7.3,9.4) -- (5,10);
draw (9,8) -- (7.3,9.4);
draw (10,5) -- (9,8);
draw (5,10) -- (2.3,9.4);
draw (0,5) -- (0.7,7);
draw (0.9,7.7) -- (2.3,9.5);
draw (5,0) -- (7.3,0.42);
draw (7.3,0.42) -- (9,2);
filldraw[fill=black!40,draw=black!80] (0,5) circle (2pt) node[anchor=east] {10};
filldraw[fill=black!40,draw=black!80] (5,0) circle (2pt) node[anchor=north] {7};
filldraw[fill=black!40,draw=black!80] (5,10) circle (2pt) node[anchor=south] {1};
filldraw[fill=black!40,draw=black!80] (10,5) circle (2pt)node[anchor=west] {4};
filldraw[fill=black!40,draw=black!80] (9,2) circle (2pt) node[anchor=west] {5};
filldraw[fill=black!40,draw=black!80] (9,8) circle (2pt) node[anchor=west] {3};
filldraw[fill=black!40,draw=black!80] (1,2) circle (2pt) node[anchor=east] {9};
filldraw[fill=black!40,draw=black!80] (7.3,0.42) circle (2pt) node[anchor=west] {6};
filldraw[fill=black!40,draw=black!80] (7.3,9.4) circle (2pt) node[anchor=west] {2};
filldraw[fill=black!40,draw=black!80] (2.3,9.4) circle (2pt) node[anchor=south] {n};
filldraw[fill=black!40,draw=black!80] (2.3,0.42) circle (2pt) node[anchor=north] {8};
filldraw[fill=white!40,draw=white!80] (1.7,7.5) circle (2pt) node[anchor=east] {dots};

end{tikzpicture}

end{document}


and it gives me something similar to what I want, but I only need that the graph is directed but when I put something like:



draw [->](7.3,9.4)  --  (5,10);


It allways give errors. I have tryied to install other packages and user other compilators (TeXworks,TeXmaker and Overleaf) but I haven't managed to fix this. Please help.










share|improve this question









New contributor




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












I am new using Tikz, and I am trying to know how to draw graphs, my try is:



documentclass[11pt]{article}

usepackage{tikz}


begin{document}

begin{tikzpicture}[y=.4cm, x=.4cm,font=normalsize]
draw (0,5) -- (1,2);
draw (1,2) -- (2.3,0.42) ;
draw (5,0) -- (2.3,0.42) ;
draw (9,2) -- (10,5);
draw (7.3,9.4) -- (5,10);
draw (9,8) -- (7.3,9.4);
draw (10,5) -- (9,8);
draw (5,10) -- (2.3,9.4);
draw (0,5) -- (0.7,7);
draw (0.9,7.7) -- (2.3,9.5);
draw (5,0) -- (7.3,0.42);
draw (7.3,0.42) -- (9,2);
filldraw[fill=black!40,draw=black!80] (0,5) circle (2pt) node[anchor=east] {10};
filldraw[fill=black!40,draw=black!80] (5,0) circle (2pt) node[anchor=north] {7};
filldraw[fill=black!40,draw=black!80] (5,10) circle (2pt) node[anchor=south] {1};
filldraw[fill=black!40,draw=black!80] (10,5) circle (2pt)node[anchor=west] {4};
filldraw[fill=black!40,draw=black!80] (9,2) circle (2pt) node[anchor=west] {5};
filldraw[fill=black!40,draw=black!80] (9,8) circle (2pt) node[anchor=west] {3};
filldraw[fill=black!40,draw=black!80] (1,2) circle (2pt) node[anchor=east] {9};
filldraw[fill=black!40,draw=black!80] (7.3,0.42) circle (2pt) node[anchor=west] {6};
filldraw[fill=black!40,draw=black!80] (7.3,9.4) circle (2pt) node[anchor=west] {2};
filldraw[fill=black!40,draw=black!80] (2.3,9.4) circle (2pt) node[anchor=south] {n};
filldraw[fill=black!40,draw=black!80] (2.3,0.42) circle (2pt) node[anchor=north] {8};
filldraw[fill=white!40,draw=white!80] (1.7,7.5) circle (2pt) node[anchor=east] {dots};

end{tikzpicture}

end{document}


and it gives me something similar to what I want, but I only need that the graph is directed but when I put something like:



draw [->](7.3,9.4)  --  (5,10);


It allways give errors. I have tryied to install other packages and user other compilators (TeXworks,TeXmaker and Overleaf) but I haven't managed to fix this. Please help.







tikz-arrows graphs






share|improve this question









New contributor




J.Rodriguez 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




J.Rodriguez 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 mins ago









Kurt

37.1k847162




37.1k847162






New contributor




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









asked 14 mins ago









J.RodriguezJ.Rodriguez

61




61




New contributor




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





New contributor





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






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













  • Welcome to TeX.SE! The errors may come from [...] instead of [...], i.e. try draw [->](7.3,9.4) -- (5,10);. Yet you can simplify the graph a lot.

    – marmot
    4 mins ago











  • Yes! I know it can be simplified a lot, I am new at this and trying to learn. Actually it worked with draw [ latex-]

    – J.Rodriguez
    15 secs ago



















  • Welcome to TeX.SE! The errors may come from [...] instead of [...], i.e. try draw [->](7.3,9.4) -- (5,10);. Yet you can simplify the graph a lot.

    – marmot
    4 mins ago











  • Yes! I know it can be simplified a lot, I am new at this and trying to learn. Actually it worked with draw [ latex-]

    – J.Rodriguez
    15 secs ago

















Welcome to TeX.SE! The errors may come from [...] instead of [...], i.e. try draw [->](7.3,9.4) -- (5,10);. Yet you can simplify the graph a lot.

– marmot
4 mins ago





Welcome to TeX.SE! The errors may come from [...] instead of [...], i.e. try draw [->](7.3,9.4) -- (5,10);. Yet you can simplify the graph a lot.

– marmot
4 mins ago













Yes! I know it can be simplified a lot, I am new at this and trying to learn. Actually it worked with draw [ latex-]

– J.Rodriguez
15 secs ago





Yes! I know it can be simplified a lot, I am new at this and trying to learn. Actually it worked with draw [ latex-]

– J.Rodriguez
15 secs ago










1 Answer
1






active

oldest

votes


















0














Using



draw [latex-](0,5)  --  (1,2);


it can fix the problem.





share








New contributor




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




















    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
    });


    }
    });






    J.Rodriguez 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%2f473700%2fhow-to-draw-this-directed-graph-with-tikz%23new-answer', 'question_page');
    }
    );

    Post as a guest















    Required, but never shown

























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    0














    Using



    draw [latex-](0,5)  --  (1,2);


    it can fix the problem.





    share








    New contributor




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

























      0














      Using



      draw [latex-](0,5)  --  (1,2);


      it can fix the problem.





      share








      New contributor




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























        0












        0








        0







        Using



        draw [latex-](0,5)  --  (1,2);


        it can fix the problem.





        share








        New contributor




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










        Using



        draw [latex-](0,5)  --  (1,2);


        it can fix the problem.






        share








        New contributor




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








        share


        share






        New contributor




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









        answered 3 mins ago









        J.RodriguezJ.Rodriguez

        61




        61




        New contributor




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





        New contributor





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






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






















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










            draft saved

            draft discarded


















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













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












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
















            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.




            draft saved


            draft discarded














            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f473700%2fhow-to-draw-this-directed-graph-with-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

            Lallio

            Futebolista

            Jornalista