How to optimize this codes of graphs with tikzTikz graphs with typeset nodesImprove node spacing using tikz...

How does Leonard in "Memento" remember reading and writing?

Why is there a prohibition of gevinat aku"m?

Which communication protocol is used in AdLib sound card?

Why did Democrats in the Senate oppose the Born-Alive Abortion Survivors Protection Act?

How do you voice extended chords?

Premature ending of generator in list comprehension

What happens when I Twin Life Transference?

Globe trotting Grandpa. Where is he going next?

Why would space fleets be aligned?

Why is it that Bernie Sanders is always called a "socialist"?

What will happen if I transfer large sums of money into my bank account from a pre-paid debit card or gift card?

Why is Agricola named as such?

Visualize manifold specified by equalities

Citing paid articles from illegal web sharing

Why does magnet wire need to be insulated?

Can 5 Aarakocra PCs summon an Air Elemental?

What game did these black and yellow dice come from?

Is using an 'empty' metaphor considered bad style?

Does diversity provide anything that meritocracy does not?

How to not let the Identify spell spoil everything?

Why avoid shared user accounts?

Airplane generations - how does it work?

systemd service won't start nodejs

Cat is tipping over bed-side lamps during the night



How to optimize this codes of graphs with tikz


Tikz graphs with typeset nodesImprove node spacing using tikz graphs (no LuaTex)Help with Tikz to draw graphs with squiggly edgesFile explorer-like tree using TiKZ/graphsTikZ graphs: Specify edge target anchorHow to draw this picture with tikz?TikZ graphs vs. czech babelSelf-loop with tikz-graphdrawing librarytikz graphs library: Edge label syntaxHow to draw this cyclic graph with tikz













0















I am trying to learn Tikz and I want to know if there is a way to optimize this 2 graphs. Thanks.



documentclass[11pt]{article}    
usepackage{tikz}
begin{document}


begin{figure}[ht]
centering
begin{tikzpicture}[y=.6cm, x=.6cm,font=small]

draw [dashed,-latex](-1,1) -- (1,1);
draw [-latex](1,1) -- (3,1);
draw [-latex](3,1) -- (5,1);
draw [-latex](5,1) -- (7,1);
draw [-latex](7,1) -- (9,1);
draw [dashed,-latex](9,1) -- (11,1);

draw [dashed,-latex](-1,3) -- (1,3);
draw [-latex](1,3) -- (3,3);
draw [-latex](3,3) -- (5,3);
draw [-latex](5,3) -- (7,3);
draw [-latex](7,3) -- (9,3);
draw [dashed,-latex](9,3) -- (11,3);

draw [dashed,-latex](-1,5) -- (1,5);
draw [-latex](1,5) -- (3,5);
draw [-latex](3,5) -- (5,5);
draw [-latex](5,5) -- (7,5);
draw [-latex](7,5) -- (9,5);
draw [dashed,-latex](9,5) -- (11,5);

draw [dashed,-latex](-1,7) -- (1,7);
draw [-latex](1,7) -- (3,7);
draw [-latex](3,7) -- (5,7);
draw [-latex](5,7) -- (7,7);
draw [-latex](7,7) -- (9,7);
draw [dashed,-latex](9,7) -- (11,7);

draw [dashed,-latex,blue](1,-1) -- (1,1);
draw [-latex,blue](1,1) -- (1,3);
draw [-latex,blue](1,3) -- (1,5);
draw [-latex,blue](1,5) -- (1,7);
draw [dashed,-latex,blue](1,7) -- (1,9);

draw [dashed,-latex,blue](3,-1) -- (3,1);
draw [-latex,blue](3,1) -- (3,3);
draw [-latex,blue](3,3) -- (3,5);
draw [-latex,blue](3,5) -- (3,7);
draw [dashed,-latex,blue](3,7) -- (3,9);

draw [dashed,-latex,blue](5,-1) -- (5,1);
draw [-latex,blue](5,1) -- (5,3);
draw [-latex,blue](5,3) -- (5,5);
draw [-latex,blue](5,5) -- (5,7);
draw [dashed,-latex,blue](5,7) -- (5,9);

draw [dashed,-latex,blue](7,-1) -- (7,1);
draw [-latex,blue](7,1) -- (7,3);
draw [-latex,blue](7,3) -- (7,5);
draw [-latex,blue](7,5) -- (7,7);
draw [dashed,-latex,blue](7,7) -- (7,9);

draw [dashed,-latex,blue](9,-1) -- (9,1);
draw [-latex,blue](9,1) -- (9,3);
draw [-latex,blue](9,3) -- (9,5);
draw [-latex,blue](9,5) -- (9,7);
draw [dashed,-latex,blue](9,7) -- (9,9);

filldraw[fill=black!40,draw=black!80] (1,1) circle (2pt) node[anchor=east]{} ;
filldraw[fill=black!40,draw=black!80] (1,3) circle (2pt) node[anchor=east]{} ;
filldraw[fill=black!40,draw=black!80] (1,5) circle (2pt) node[anchor=east]{} ;
filldraw[fill=black!40,draw=black!80] (1,7) circle (2pt) node[anchor=east]{} ;
filldraw[fill=black!40,draw=black!80] (3,1) circle (2pt) node[anchor=east]{} ;
filldraw[fill=black!40,draw=black!80] (5,1) circle (2pt) node[anchor=east]{} ;
filldraw[fill=black!40,draw=black!80] (7,1) circle (2pt) node[anchor=east]{} ;
filldraw[fill=black!40,draw=black!80] (9,1) circle (2pt) node[anchor=east]{} ;
filldraw[fill=black!40,draw=black!80] (3,3) circle (2pt) node[anchor=east]{} ;
filldraw[fill=black!40,draw=black!80] (3,5) circle (2pt) node[anchor=east]{} ;
filldraw[fill=black!40,draw=black!80] (3,7) circle (2pt) node[anchor=east]{} ;
filldraw[fill=black!40,draw=black!80] (5,3) circle (2pt) node[anchor=east]{} ;
filldraw[fill=black!40,draw=black!80] (5,5) circle (2pt) node[anchor=east]{} ;
filldraw[fill=black!40,draw=black!80] (5,7) circle (2pt) node[anchor=east]{} ;
filldraw[fill=black!40,draw=black!80] (7,3) circle (2pt) node[anchor=east]{} ;
filldraw[fill=black!40,draw=black!80] (7,5) circle (2pt) node[anchor=east]{} ;
filldraw[fill=black!40,draw=black!80] (7,7) circle (2pt) node[anchor=east]{} ;
filldraw[fill=black!40,draw=black!80] (9,3) circle (2pt) node[anchor=east]{} ;
filldraw[fill=black!40,draw=black!80] (9,5) circle (2pt) node[anchor=east]{} ;
filldraw[fill=black!40,draw=black!80] (9,7) circle (2pt) node[anchor=east]{} ;
end{tikzpicture}
end{figure}

%AND THIS OTHER


begin{figure}[ht]
centering
begin{tikzpicture}[y=.6cm, x=.6cm,font=small]

draw [latex-](3,1) -- (1,3);
draw [latex-](1,3) -- (3,3);
draw [latex-](3,3) -- (3,1);

draw [-latex](7,1) -- (7,3);
draw [-latex](7,3) -- (9,3);
draw [-latex](9,3) -- (7,1);

draw [-latex](7,7) -- (9,7);
draw [-latex](9,7) -- (7,9);
draw [-latex](7,9) -- (7,7);

draw [-latex](1,7) -- (3,9);
draw [-latex](3,9) -- (3,7);
draw [-latex](3,7) -- (1,7);

draw [latex-latex,dashed,red](3,7) -- (7,3);
draw [latex-latex,dashed,red](1,3) -- (1,7);
draw [latex-latex,dashed,red](3,1) -- (7,1);
draw [latex-latex,dashed,red](9,3) -- (9,7);
draw [latex-latex,dashed,red](7,9) -- (3,9);
draw [latex-latex,dashed,red](7,7) -- (3,3);

filldraw[fill=black!40,draw=black!80] (3,1) circle (2pt) node[anchor=north]{(243)} ;
filldraw[fill=black!40,draw=black!80] (3,3) circle (2pt) node[anchor=west]{(143)} ;
filldraw[fill=black!40,draw=black!80] (3,7) circle (2pt) node[anchor=west]{(132)} ;
filldraw[fill=black!40,draw=black!80] (3,9) circle (2pt) node[anchor=east]{(123)} ;

filldraw[fill=black!40,draw=black!80] (7,1) circle (2pt) node[anchor=north]{(142)} ;
filldraw[fill=black!40,draw=black!80] (7,3) circle (2pt) node[anchor=east]{(234)} ;
filldraw[fill=black!40,draw=black!80] (7,7) circle (2pt) node[anchor=east]{(124)} ;
filldraw[fill=black!40,draw=black!80] (7,9) circle (2pt) node[anchor=west]{(134)} ;

filldraw[fill=black!40,draw=black!80] (1,3) circle (2pt) node[anchor=east]{(12)(34)} ;
filldraw[fill=black!40,draw=black!80] (1,7) circle (2pt) node[anchor=east]{e} ;
filldraw[fill=black!40,draw=black!80] (9,3) circle (2pt) node[anchor=west]{(13)(24)} ;
filldraw[fill=black!40,draw=black!80] (9,7) circle (2pt) node[anchor=west]{(14)(23)} ;
end{tikzpicture}


end{figure}



end{document}


I know it is large but I am trying to know how to write in this language. Also if you know a concise page or book to learn how to use Tikz, it would help me a lot. Thanks.









share























  • It is rather easy to simplify it but the most immediate simplification arises from introducing foreach loops. They are described in the pgfmanual in section 87 Repeating Things: The Foreach Statement.

    – marmot
    3 mins ago
















0















I am trying to learn Tikz and I want to know if there is a way to optimize this 2 graphs. Thanks.



documentclass[11pt]{article}    
usepackage{tikz}
begin{document}


begin{figure}[ht]
centering
begin{tikzpicture}[y=.6cm, x=.6cm,font=small]

draw [dashed,-latex](-1,1) -- (1,1);
draw [-latex](1,1) -- (3,1);
draw [-latex](3,1) -- (5,1);
draw [-latex](5,1) -- (7,1);
draw [-latex](7,1) -- (9,1);
draw [dashed,-latex](9,1) -- (11,1);

draw [dashed,-latex](-1,3) -- (1,3);
draw [-latex](1,3) -- (3,3);
draw [-latex](3,3) -- (5,3);
draw [-latex](5,3) -- (7,3);
draw [-latex](7,3) -- (9,3);
draw [dashed,-latex](9,3) -- (11,3);

draw [dashed,-latex](-1,5) -- (1,5);
draw [-latex](1,5) -- (3,5);
draw [-latex](3,5) -- (5,5);
draw [-latex](5,5) -- (7,5);
draw [-latex](7,5) -- (9,5);
draw [dashed,-latex](9,5) -- (11,5);

draw [dashed,-latex](-1,7) -- (1,7);
draw [-latex](1,7) -- (3,7);
draw [-latex](3,7) -- (5,7);
draw [-latex](5,7) -- (7,7);
draw [-latex](7,7) -- (9,7);
draw [dashed,-latex](9,7) -- (11,7);

draw [dashed,-latex,blue](1,-1) -- (1,1);
draw [-latex,blue](1,1) -- (1,3);
draw [-latex,blue](1,3) -- (1,5);
draw [-latex,blue](1,5) -- (1,7);
draw [dashed,-latex,blue](1,7) -- (1,9);

draw [dashed,-latex,blue](3,-1) -- (3,1);
draw [-latex,blue](3,1) -- (3,3);
draw [-latex,blue](3,3) -- (3,5);
draw [-latex,blue](3,5) -- (3,7);
draw [dashed,-latex,blue](3,7) -- (3,9);

draw [dashed,-latex,blue](5,-1) -- (5,1);
draw [-latex,blue](5,1) -- (5,3);
draw [-latex,blue](5,3) -- (5,5);
draw [-latex,blue](5,5) -- (5,7);
draw [dashed,-latex,blue](5,7) -- (5,9);

draw [dashed,-latex,blue](7,-1) -- (7,1);
draw [-latex,blue](7,1) -- (7,3);
draw [-latex,blue](7,3) -- (7,5);
draw [-latex,blue](7,5) -- (7,7);
draw [dashed,-latex,blue](7,7) -- (7,9);

draw [dashed,-latex,blue](9,-1) -- (9,1);
draw [-latex,blue](9,1) -- (9,3);
draw [-latex,blue](9,3) -- (9,5);
draw [-latex,blue](9,5) -- (9,7);
draw [dashed,-latex,blue](9,7) -- (9,9);

filldraw[fill=black!40,draw=black!80] (1,1) circle (2pt) node[anchor=east]{} ;
filldraw[fill=black!40,draw=black!80] (1,3) circle (2pt) node[anchor=east]{} ;
filldraw[fill=black!40,draw=black!80] (1,5) circle (2pt) node[anchor=east]{} ;
filldraw[fill=black!40,draw=black!80] (1,7) circle (2pt) node[anchor=east]{} ;
filldraw[fill=black!40,draw=black!80] (3,1) circle (2pt) node[anchor=east]{} ;
filldraw[fill=black!40,draw=black!80] (5,1) circle (2pt) node[anchor=east]{} ;
filldraw[fill=black!40,draw=black!80] (7,1) circle (2pt) node[anchor=east]{} ;
filldraw[fill=black!40,draw=black!80] (9,1) circle (2pt) node[anchor=east]{} ;
filldraw[fill=black!40,draw=black!80] (3,3) circle (2pt) node[anchor=east]{} ;
filldraw[fill=black!40,draw=black!80] (3,5) circle (2pt) node[anchor=east]{} ;
filldraw[fill=black!40,draw=black!80] (3,7) circle (2pt) node[anchor=east]{} ;
filldraw[fill=black!40,draw=black!80] (5,3) circle (2pt) node[anchor=east]{} ;
filldraw[fill=black!40,draw=black!80] (5,5) circle (2pt) node[anchor=east]{} ;
filldraw[fill=black!40,draw=black!80] (5,7) circle (2pt) node[anchor=east]{} ;
filldraw[fill=black!40,draw=black!80] (7,3) circle (2pt) node[anchor=east]{} ;
filldraw[fill=black!40,draw=black!80] (7,5) circle (2pt) node[anchor=east]{} ;
filldraw[fill=black!40,draw=black!80] (7,7) circle (2pt) node[anchor=east]{} ;
filldraw[fill=black!40,draw=black!80] (9,3) circle (2pt) node[anchor=east]{} ;
filldraw[fill=black!40,draw=black!80] (9,5) circle (2pt) node[anchor=east]{} ;
filldraw[fill=black!40,draw=black!80] (9,7) circle (2pt) node[anchor=east]{} ;
end{tikzpicture}
end{figure}

%AND THIS OTHER


begin{figure}[ht]
centering
begin{tikzpicture}[y=.6cm, x=.6cm,font=small]

draw [latex-](3,1) -- (1,3);
draw [latex-](1,3) -- (3,3);
draw [latex-](3,3) -- (3,1);

draw [-latex](7,1) -- (7,3);
draw [-latex](7,3) -- (9,3);
draw [-latex](9,3) -- (7,1);

draw [-latex](7,7) -- (9,7);
draw [-latex](9,7) -- (7,9);
draw [-latex](7,9) -- (7,7);

draw [-latex](1,7) -- (3,9);
draw [-latex](3,9) -- (3,7);
draw [-latex](3,7) -- (1,7);

draw [latex-latex,dashed,red](3,7) -- (7,3);
draw [latex-latex,dashed,red](1,3) -- (1,7);
draw [latex-latex,dashed,red](3,1) -- (7,1);
draw [latex-latex,dashed,red](9,3) -- (9,7);
draw [latex-latex,dashed,red](7,9) -- (3,9);
draw [latex-latex,dashed,red](7,7) -- (3,3);

filldraw[fill=black!40,draw=black!80] (3,1) circle (2pt) node[anchor=north]{(243)} ;
filldraw[fill=black!40,draw=black!80] (3,3) circle (2pt) node[anchor=west]{(143)} ;
filldraw[fill=black!40,draw=black!80] (3,7) circle (2pt) node[anchor=west]{(132)} ;
filldraw[fill=black!40,draw=black!80] (3,9) circle (2pt) node[anchor=east]{(123)} ;

filldraw[fill=black!40,draw=black!80] (7,1) circle (2pt) node[anchor=north]{(142)} ;
filldraw[fill=black!40,draw=black!80] (7,3) circle (2pt) node[anchor=east]{(234)} ;
filldraw[fill=black!40,draw=black!80] (7,7) circle (2pt) node[anchor=east]{(124)} ;
filldraw[fill=black!40,draw=black!80] (7,9) circle (2pt) node[anchor=west]{(134)} ;

filldraw[fill=black!40,draw=black!80] (1,3) circle (2pt) node[anchor=east]{(12)(34)} ;
filldraw[fill=black!40,draw=black!80] (1,7) circle (2pt) node[anchor=east]{e} ;
filldraw[fill=black!40,draw=black!80] (9,3) circle (2pt) node[anchor=west]{(13)(24)} ;
filldraw[fill=black!40,draw=black!80] (9,7) circle (2pt) node[anchor=west]{(14)(23)} ;
end{tikzpicture}


end{figure}



end{document}


I know it is large but I am trying to know how to write in this language. Also if you know a concise page or book to learn how to use Tikz, it would help me a lot. Thanks.









share























  • It is rather easy to simplify it but the most immediate simplification arises from introducing foreach loops. They are described in the pgfmanual in section 87 Repeating Things: The Foreach Statement.

    – marmot
    3 mins ago














0












0








0








I am trying to learn Tikz and I want to know if there is a way to optimize this 2 graphs. Thanks.



documentclass[11pt]{article}    
usepackage{tikz}
begin{document}


begin{figure}[ht]
centering
begin{tikzpicture}[y=.6cm, x=.6cm,font=small]

draw [dashed,-latex](-1,1) -- (1,1);
draw [-latex](1,1) -- (3,1);
draw [-latex](3,1) -- (5,1);
draw [-latex](5,1) -- (7,1);
draw [-latex](7,1) -- (9,1);
draw [dashed,-latex](9,1) -- (11,1);

draw [dashed,-latex](-1,3) -- (1,3);
draw [-latex](1,3) -- (3,3);
draw [-latex](3,3) -- (5,3);
draw [-latex](5,3) -- (7,3);
draw [-latex](7,3) -- (9,3);
draw [dashed,-latex](9,3) -- (11,3);

draw [dashed,-latex](-1,5) -- (1,5);
draw [-latex](1,5) -- (3,5);
draw [-latex](3,5) -- (5,5);
draw [-latex](5,5) -- (7,5);
draw [-latex](7,5) -- (9,5);
draw [dashed,-latex](9,5) -- (11,5);

draw [dashed,-latex](-1,7) -- (1,7);
draw [-latex](1,7) -- (3,7);
draw [-latex](3,7) -- (5,7);
draw [-latex](5,7) -- (7,7);
draw [-latex](7,7) -- (9,7);
draw [dashed,-latex](9,7) -- (11,7);

draw [dashed,-latex,blue](1,-1) -- (1,1);
draw [-latex,blue](1,1) -- (1,3);
draw [-latex,blue](1,3) -- (1,5);
draw [-latex,blue](1,5) -- (1,7);
draw [dashed,-latex,blue](1,7) -- (1,9);

draw [dashed,-latex,blue](3,-1) -- (3,1);
draw [-latex,blue](3,1) -- (3,3);
draw [-latex,blue](3,3) -- (3,5);
draw [-latex,blue](3,5) -- (3,7);
draw [dashed,-latex,blue](3,7) -- (3,9);

draw [dashed,-latex,blue](5,-1) -- (5,1);
draw [-latex,blue](5,1) -- (5,3);
draw [-latex,blue](5,3) -- (5,5);
draw [-latex,blue](5,5) -- (5,7);
draw [dashed,-latex,blue](5,7) -- (5,9);

draw [dashed,-latex,blue](7,-1) -- (7,1);
draw [-latex,blue](7,1) -- (7,3);
draw [-latex,blue](7,3) -- (7,5);
draw [-latex,blue](7,5) -- (7,7);
draw [dashed,-latex,blue](7,7) -- (7,9);

draw [dashed,-latex,blue](9,-1) -- (9,1);
draw [-latex,blue](9,1) -- (9,3);
draw [-latex,blue](9,3) -- (9,5);
draw [-latex,blue](9,5) -- (9,7);
draw [dashed,-latex,blue](9,7) -- (9,9);

filldraw[fill=black!40,draw=black!80] (1,1) circle (2pt) node[anchor=east]{} ;
filldraw[fill=black!40,draw=black!80] (1,3) circle (2pt) node[anchor=east]{} ;
filldraw[fill=black!40,draw=black!80] (1,5) circle (2pt) node[anchor=east]{} ;
filldraw[fill=black!40,draw=black!80] (1,7) circle (2pt) node[anchor=east]{} ;
filldraw[fill=black!40,draw=black!80] (3,1) circle (2pt) node[anchor=east]{} ;
filldraw[fill=black!40,draw=black!80] (5,1) circle (2pt) node[anchor=east]{} ;
filldraw[fill=black!40,draw=black!80] (7,1) circle (2pt) node[anchor=east]{} ;
filldraw[fill=black!40,draw=black!80] (9,1) circle (2pt) node[anchor=east]{} ;
filldraw[fill=black!40,draw=black!80] (3,3) circle (2pt) node[anchor=east]{} ;
filldraw[fill=black!40,draw=black!80] (3,5) circle (2pt) node[anchor=east]{} ;
filldraw[fill=black!40,draw=black!80] (3,7) circle (2pt) node[anchor=east]{} ;
filldraw[fill=black!40,draw=black!80] (5,3) circle (2pt) node[anchor=east]{} ;
filldraw[fill=black!40,draw=black!80] (5,5) circle (2pt) node[anchor=east]{} ;
filldraw[fill=black!40,draw=black!80] (5,7) circle (2pt) node[anchor=east]{} ;
filldraw[fill=black!40,draw=black!80] (7,3) circle (2pt) node[anchor=east]{} ;
filldraw[fill=black!40,draw=black!80] (7,5) circle (2pt) node[anchor=east]{} ;
filldraw[fill=black!40,draw=black!80] (7,7) circle (2pt) node[anchor=east]{} ;
filldraw[fill=black!40,draw=black!80] (9,3) circle (2pt) node[anchor=east]{} ;
filldraw[fill=black!40,draw=black!80] (9,5) circle (2pt) node[anchor=east]{} ;
filldraw[fill=black!40,draw=black!80] (9,7) circle (2pt) node[anchor=east]{} ;
end{tikzpicture}
end{figure}

%AND THIS OTHER


begin{figure}[ht]
centering
begin{tikzpicture}[y=.6cm, x=.6cm,font=small]

draw [latex-](3,1) -- (1,3);
draw [latex-](1,3) -- (3,3);
draw [latex-](3,3) -- (3,1);

draw [-latex](7,1) -- (7,3);
draw [-latex](7,3) -- (9,3);
draw [-latex](9,3) -- (7,1);

draw [-latex](7,7) -- (9,7);
draw [-latex](9,7) -- (7,9);
draw [-latex](7,9) -- (7,7);

draw [-latex](1,7) -- (3,9);
draw [-latex](3,9) -- (3,7);
draw [-latex](3,7) -- (1,7);

draw [latex-latex,dashed,red](3,7) -- (7,3);
draw [latex-latex,dashed,red](1,3) -- (1,7);
draw [latex-latex,dashed,red](3,1) -- (7,1);
draw [latex-latex,dashed,red](9,3) -- (9,7);
draw [latex-latex,dashed,red](7,9) -- (3,9);
draw [latex-latex,dashed,red](7,7) -- (3,3);

filldraw[fill=black!40,draw=black!80] (3,1) circle (2pt) node[anchor=north]{(243)} ;
filldraw[fill=black!40,draw=black!80] (3,3) circle (2pt) node[anchor=west]{(143)} ;
filldraw[fill=black!40,draw=black!80] (3,7) circle (2pt) node[anchor=west]{(132)} ;
filldraw[fill=black!40,draw=black!80] (3,9) circle (2pt) node[anchor=east]{(123)} ;

filldraw[fill=black!40,draw=black!80] (7,1) circle (2pt) node[anchor=north]{(142)} ;
filldraw[fill=black!40,draw=black!80] (7,3) circle (2pt) node[anchor=east]{(234)} ;
filldraw[fill=black!40,draw=black!80] (7,7) circle (2pt) node[anchor=east]{(124)} ;
filldraw[fill=black!40,draw=black!80] (7,9) circle (2pt) node[anchor=west]{(134)} ;

filldraw[fill=black!40,draw=black!80] (1,3) circle (2pt) node[anchor=east]{(12)(34)} ;
filldraw[fill=black!40,draw=black!80] (1,7) circle (2pt) node[anchor=east]{e} ;
filldraw[fill=black!40,draw=black!80] (9,3) circle (2pt) node[anchor=west]{(13)(24)} ;
filldraw[fill=black!40,draw=black!80] (9,7) circle (2pt) node[anchor=west]{(14)(23)} ;
end{tikzpicture}


end{figure}



end{document}


I know it is large but I am trying to know how to write in this language. Also if you know a concise page or book to learn how to use Tikz, it would help me a lot. Thanks.









share














I am trying to learn Tikz and I want to know if there is a way to optimize this 2 graphs. Thanks.



documentclass[11pt]{article}    
usepackage{tikz}
begin{document}


begin{figure}[ht]
centering
begin{tikzpicture}[y=.6cm, x=.6cm,font=small]

draw [dashed,-latex](-1,1) -- (1,1);
draw [-latex](1,1) -- (3,1);
draw [-latex](3,1) -- (5,1);
draw [-latex](5,1) -- (7,1);
draw [-latex](7,1) -- (9,1);
draw [dashed,-latex](9,1) -- (11,1);

draw [dashed,-latex](-1,3) -- (1,3);
draw [-latex](1,3) -- (3,3);
draw [-latex](3,3) -- (5,3);
draw [-latex](5,3) -- (7,3);
draw [-latex](7,3) -- (9,3);
draw [dashed,-latex](9,3) -- (11,3);

draw [dashed,-latex](-1,5) -- (1,5);
draw [-latex](1,5) -- (3,5);
draw [-latex](3,5) -- (5,5);
draw [-latex](5,5) -- (7,5);
draw [-latex](7,5) -- (9,5);
draw [dashed,-latex](9,5) -- (11,5);

draw [dashed,-latex](-1,7) -- (1,7);
draw [-latex](1,7) -- (3,7);
draw [-latex](3,7) -- (5,7);
draw [-latex](5,7) -- (7,7);
draw [-latex](7,7) -- (9,7);
draw [dashed,-latex](9,7) -- (11,7);

draw [dashed,-latex,blue](1,-1) -- (1,1);
draw [-latex,blue](1,1) -- (1,3);
draw [-latex,blue](1,3) -- (1,5);
draw [-latex,blue](1,5) -- (1,7);
draw [dashed,-latex,blue](1,7) -- (1,9);

draw [dashed,-latex,blue](3,-1) -- (3,1);
draw [-latex,blue](3,1) -- (3,3);
draw [-latex,blue](3,3) -- (3,5);
draw [-latex,blue](3,5) -- (3,7);
draw [dashed,-latex,blue](3,7) -- (3,9);

draw [dashed,-latex,blue](5,-1) -- (5,1);
draw [-latex,blue](5,1) -- (5,3);
draw [-latex,blue](5,3) -- (5,5);
draw [-latex,blue](5,5) -- (5,7);
draw [dashed,-latex,blue](5,7) -- (5,9);

draw [dashed,-latex,blue](7,-1) -- (7,1);
draw [-latex,blue](7,1) -- (7,3);
draw [-latex,blue](7,3) -- (7,5);
draw [-latex,blue](7,5) -- (7,7);
draw [dashed,-latex,blue](7,7) -- (7,9);

draw [dashed,-latex,blue](9,-1) -- (9,1);
draw [-latex,blue](9,1) -- (9,3);
draw [-latex,blue](9,3) -- (9,5);
draw [-latex,blue](9,5) -- (9,7);
draw [dashed,-latex,blue](9,7) -- (9,9);

filldraw[fill=black!40,draw=black!80] (1,1) circle (2pt) node[anchor=east]{} ;
filldraw[fill=black!40,draw=black!80] (1,3) circle (2pt) node[anchor=east]{} ;
filldraw[fill=black!40,draw=black!80] (1,5) circle (2pt) node[anchor=east]{} ;
filldraw[fill=black!40,draw=black!80] (1,7) circle (2pt) node[anchor=east]{} ;
filldraw[fill=black!40,draw=black!80] (3,1) circle (2pt) node[anchor=east]{} ;
filldraw[fill=black!40,draw=black!80] (5,1) circle (2pt) node[anchor=east]{} ;
filldraw[fill=black!40,draw=black!80] (7,1) circle (2pt) node[anchor=east]{} ;
filldraw[fill=black!40,draw=black!80] (9,1) circle (2pt) node[anchor=east]{} ;
filldraw[fill=black!40,draw=black!80] (3,3) circle (2pt) node[anchor=east]{} ;
filldraw[fill=black!40,draw=black!80] (3,5) circle (2pt) node[anchor=east]{} ;
filldraw[fill=black!40,draw=black!80] (3,7) circle (2pt) node[anchor=east]{} ;
filldraw[fill=black!40,draw=black!80] (5,3) circle (2pt) node[anchor=east]{} ;
filldraw[fill=black!40,draw=black!80] (5,5) circle (2pt) node[anchor=east]{} ;
filldraw[fill=black!40,draw=black!80] (5,7) circle (2pt) node[anchor=east]{} ;
filldraw[fill=black!40,draw=black!80] (7,3) circle (2pt) node[anchor=east]{} ;
filldraw[fill=black!40,draw=black!80] (7,5) circle (2pt) node[anchor=east]{} ;
filldraw[fill=black!40,draw=black!80] (7,7) circle (2pt) node[anchor=east]{} ;
filldraw[fill=black!40,draw=black!80] (9,3) circle (2pt) node[anchor=east]{} ;
filldraw[fill=black!40,draw=black!80] (9,5) circle (2pt) node[anchor=east]{} ;
filldraw[fill=black!40,draw=black!80] (9,7) circle (2pt) node[anchor=east]{} ;
end{tikzpicture}
end{figure}

%AND THIS OTHER


begin{figure}[ht]
centering
begin{tikzpicture}[y=.6cm, x=.6cm,font=small]

draw [latex-](3,1) -- (1,3);
draw [latex-](1,3) -- (3,3);
draw [latex-](3,3) -- (3,1);

draw [-latex](7,1) -- (7,3);
draw [-latex](7,3) -- (9,3);
draw [-latex](9,3) -- (7,1);

draw [-latex](7,7) -- (9,7);
draw [-latex](9,7) -- (7,9);
draw [-latex](7,9) -- (7,7);

draw [-latex](1,7) -- (3,9);
draw [-latex](3,9) -- (3,7);
draw [-latex](3,7) -- (1,7);

draw [latex-latex,dashed,red](3,7) -- (7,3);
draw [latex-latex,dashed,red](1,3) -- (1,7);
draw [latex-latex,dashed,red](3,1) -- (7,1);
draw [latex-latex,dashed,red](9,3) -- (9,7);
draw [latex-latex,dashed,red](7,9) -- (3,9);
draw [latex-latex,dashed,red](7,7) -- (3,3);

filldraw[fill=black!40,draw=black!80] (3,1) circle (2pt) node[anchor=north]{(243)} ;
filldraw[fill=black!40,draw=black!80] (3,3) circle (2pt) node[anchor=west]{(143)} ;
filldraw[fill=black!40,draw=black!80] (3,7) circle (2pt) node[anchor=west]{(132)} ;
filldraw[fill=black!40,draw=black!80] (3,9) circle (2pt) node[anchor=east]{(123)} ;

filldraw[fill=black!40,draw=black!80] (7,1) circle (2pt) node[anchor=north]{(142)} ;
filldraw[fill=black!40,draw=black!80] (7,3) circle (2pt) node[anchor=east]{(234)} ;
filldraw[fill=black!40,draw=black!80] (7,7) circle (2pt) node[anchor=east]{(124)} ;
filldraw[fill=black!40,draw=black!80] (7,9) circle (2pt) node[anchor=west]{(134)} ;

filldraw[fill=black!40,draw=black!80] (1,3) circle (2pt) node[anchor=east]{(12)(34)} ;
filldraw[fill=black!40,draw=black!80] (1,7) circle (2pt) node[anchor=east]{e} ;
filldraw[fill=black!40,draw=black!80] (9,3) circle (2pt) node[anchor=west]{(13)(24)} ;
filldraw[fill=black!40,draw=black!80] (9,7) circle (2pt) node[anchor=west]{(14)(23)} ;
end{tikzpicture}


end{figure}



end{document}


I know it is large but I am trying to know how to write in this language. Also if you know a concise page or book to learn how to use Tikz, it would help me a lot. Thanks.







tikz-graphs tikz-graphdrawing





share












share










share



share










asked 5 mins ago









J.RodriguezJ.Rodriguez

273




273













  • It is rather easy to simplify it but the most immediate simplification arises from introducing foreach loops. They are described in the pgfmanual in section 87 Repeating Things: The Foreach Statement.

    – marmot
    3 mins ago



















  • It is rather easy to simplify it but the most immediate simplification arises from introducing foreach loops. They are described in the pgfmanual in section 87 Repeating Things: The Foreach Statement.

    – marmot
    3 mins ago

















It is rather easy to simplify it but the most immediate simplification arises from introducing foreach loops. They are described in the pgfmanual in section 87 Repeating Things: The Foreach Statement.

– marmot
3 mins ago





It is rather easy to simplify it but the most immediate simplification arises from introducing foreach loops. They are described in the pgfmanual in section 87 Repeating Things: The Foreach Statement.

– marmot
3 mins ago










0






active

oldest

votes











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%2f476855%2fhow-to-optimize-this-codes-of-graphs-with-tikz%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























0






active

oldest

votes








0






active

oldest

votes









active

oldest

votes






active

oldest

votes
















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.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f476855%2fhow-to-optimize-this-codes-of-graphs-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

IEEEtran - How to include ORCID in TeX/PDF with PdfLatexIs there a standard way to include ORCID in TeX /...

Cicindela nigrior Przypisy | Menu nawigacyjneCicindela varians unicolorManual for the Identification of the...

Glossaries-extra: Adding glossaries package to “Clas­sicTh­e­sis” template by Dr. André Miede v. 4.6 ...