TeX - LaTeX Asked on June 8, 2021
I have the following graph
begin{figure}[H]
centering
begin{tikzpicture}
node[shape=circle,draw=black] (0) at (0,0) {$0$};
node[shape=circle,draw=black] (4) at (6,0) {$1$};
node[shape=circle,draw=black] (1) at (3,-1) {$2$};
node[shape=circle,draw=black] (2) at (3,2) {$3$};
draw (0) -- (1);
draw (0) -- (2);
draw (0) -- (4);
draw (0) -- (4);
draw (4) -- (2);
draw (2) -- (1);
end{tikzpicture}
end{figure}
I am stuck on how to name the edges e1,e2,e3,e4.
Can someone please help me out?
begin{tikzpicture}
node[shape=circle,draw=black] (0) at (0,0) {$0$};
node[shape=circle,draw=black] (4) at (6,0) {$1$};
node[shape=circle,draw=black] (1) at (3,-1) {$2$};
node[shape=circle,draw=black] (2) at (3,2) {$3$};
draw (0) -- (1) node[pos=.5, below, sloped, rotate=0] {e1};
draw (0) -- (2);
draw (0) -- (4);
draw (0) -- (4);
draw (4) -- (2);
draw (2) -- (1);
end{tikzpicture}
Answered by js bibra on June 8, 2021
It is not clear which names has particular path, but it is simple to correct/insert names. By using quotes
library you can ad them as follows:
documentclass[border=3mm]{standalone}
usepackage{tikz}
usetikzlibrary{quotes}
begin{document}
begin{tikzpicture}[
C/.style = {circle, draw}, % C: circle
every edge quotes/.style = {auto, font=footnotesize, inner sep=2pt, pos=0.4}
]
begin{scope}[nodes={C}]
node (0) {$0$};
node (4) at (6,0) {$1$};
node (1) at (3,-1) {$2$};
node (2) at (3,2) {$3$};
end{scope}
%
path (0) edge ["$e_3$"] (2)
(0) edge ["$e_1$"] (4)
(0) edge ["$e_2$"] (1)
(2) edge ["$e_4$"] (1)
(4) edge (2);
end{tikzpicture}
end{document}
Addendum:
This simple diagram can be easy drawn by employing tikz-cd
package:
documentclass[border=3mm]{standalone}
usepackage{tikz-cd}
usepackage[low-sup]{subdepth}
begin{document}
begin{tikzcd}[sep=huge,
cells={nodes={circle, draw, semithick, minimum size=1.1em,
inner sep=2pt, outer sep=0pt}},
arrows = dash,
every label/.append style = {font=footnotesize, inner sep=1pt, pos=0.35}
]
& 3 ar[dr,"e_{31}"]
ar[dd,"e_{32}"] &
0 ar[ur,"e_3"]
ar[rr,"e_1"]
ar[dr,"e_2"]
& & 1
& 2 &
end{tikzcd}
Answered by Zarko on June 8, 2021
Get help from others!
Recent Answers
Recent Questions
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP