
Como faço para que apenas algumas arestas e vértices tenham uma cor diferente?
\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{positioning}
\begin{document}
\tikzset{main node/.style={circle,fill=black,draw,minimum size=.2cm,inner sep=0pt},}
\begin{tikzpicture}
\node[main node] (1) {};
\node[main node] (2) [below left = .75cm and .5cm of 1] {};
\node[main node] (3) [below right = .75cm and .5cm of 1] {};
\path[draw,thick]
(1) edge node {} (2)
(2) edge node {} (3)
(3) edge node {} (1);
\end{tikzpicture}
\end{document}
Responder1
Basta adicionar elementos separados color = your_color
a cada nó e/ou aresta que você deseja, por exemplo,
\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{positioning}
\tikzset{main node/.style={circle,fill=black!20,draw,minimum size=.5cm,inner sep=0pt},}
\begin{document}
\tikzset{main node/.style={circle,fill=black,draw,minimum size=.2cm,inner sep=0pt},}
\begin{tikzpicture}
\node[main node, color = red] (1) {};
\node[main node] (2) [below left = .75cm and .5cm of 1] {};
\node[main node] (3) [below right = .75cm and .5cm of 1] {};
\path[draw,thick]
(1) edge [color = blue] node {} (2)
(2) edge node {} (3)
(3) edge node {} (1);
\end{tikzpicture}
\end{document}