1

enter image description hereI need to assign non-empty sets (instead of numbers) to the vertices of a graph. This may be called set-labeling of graphs. A graph with vertices having set-labels may be called set-labeled graphs (see the given figure). How can I draw set-labeled graphs using Tikz Package in LaTeX?

Thanks in advance,

  • 3
    Welcome to TeX.SX! Please post a minimal compilable code example (MWE) to help us help you. – TeXnician May 20 '17 at 7:19
  • I don't think there is anything special about numbers in the context of TikZ nodes, so if you can make a graph with numbers at the vertices, then you can make a graph with something else at the vertices. – Torbjørn T. May 20 '17 at 7:51
  • I cannot label the vertices by sets. – Sudev Naduvath May 20 '17 at 10:09
  • Why not? What have you tried? – Torbjørn T. May 20 '17 at 10:10
  • \vertex (u1) at (45:2) [label=right: $\{x_1,x_2\}$]{}; It shows error. – Sudev Naduvath May 20 '17 at 10:19
2

I don't know where you got \vertex from, but for a normal TikZ node you need to enclose the entire label in { .. }, because the parser is confused by the comma in the label. So use label={right:$\{x_1,x_2\}$} instead of label=right:$\{x_1,x_2\}$

enter image description here

\documentclass[border=5mm]{standalone}
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}
    \node [circle,fill] (u1) at (45:2) [label={right:$\{x_1,x_2\}$}]{};
\end{tikzpicture}
\end{document}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.