我怎样才能仅更改指向节点 3 的链接的颜色?

我怎样才能仅更改指向节点 3 的链接的颜色?
\documentclass{article}
\usepackage{graphicx}
% \usepackage{amsfonts}
% \usepackage{amsmath}
% \usepackage{verbatim}



\usepackage{tikz}
\usetikzlibrary{arrows}


\tikzstyle{male}=[circle,fill=blue!20,draw,font=\sffamily\Large\bfseries]
\tikzstyle{female}=[circle,fill=red!20,draw,font=\sffamily\Large\bfseries]

\begin{document}



\begin{figure}[!htb]
  \begin{tikzpicture}[->,>=stealth',shorten >=1pt,auto,node distance=3cm,thick, main  node/.style={circle,draw,fill=red!20,font=\sffamily\Large\bfseries}]
    \node[main node] (1) {1};
    \node[main node] (2) [below left of=1] {2};
    \node[main node] (3) [below right of=2] {3};
    \node[main node] (4) [below right of=1] {4};

    \path[every node/.style={font=\sffamily\small}]
      (1) edge node {} (3)
          edge [bend right] node[left] {} (2)
      (2) edge node {} (4)
          edge node {} (1)
      (3) edge node[left] {} (2)
          edge [bend right] node[right] {} (4)
      (4) edge node[left] {} (3);
    \end{tikzpicture} %
  \end{figure}

 \end{document}

答案1

要仅为指向给定节点(在本例中)的边添加颜色3,请将选项添加到任何链接的[color-name]键中。例如:edgei -> 3

...(4) edge[red] node[left] {} (3);

相关内容