如何使所有顶点大小相同?

如何使所有顶点大小相同?

我想知道如何使图中的顶点具有相同的大小并且那些水平弧实际上是水平的:

在此处输入图片描述

这是我的代码,如果您有其他问题也可以随时提出建议:

 \documentclass[12pt]{article}
 \usepackage{graphicx}
 \usepackage{subfigure}
 \usepackage{amsmath}
 \usepackage{amsfonts}

 \usepackage{tikz}
 \usetikzlibrary{positioning}

\begin{center}
\begin{tikzpicture}
  \begin{scope}[auto,%
  every node/.style={draw,fill=gray!40,circle,minimum size=3pt},node distance=2cm]
  % the vertices
  \node[label=left:Source] (source) at (0,0) {1*/0};
  \node[above left=of source] (three) {3*/20};
  \node[left=of three] (two) {2*/20};
  \node[above right=of source] (four) {4*/1};
  \node[right=of four] (five) {5*/20};
  \node[above=of two] (six) {6*/21};
  \node[above=of three] (seven) {7*/3};
  \node[above=of four] (eight) {8*/2};
  \node[above=of five] (nine) {9*/21};
  \node[above right=of seven,label=right:Sink] (sink) {11*/4};
  \end{scope}
  % the edges
  \draw (source) -- node[label=above:20] {} (two) -- node[label=right:1] {} (six) -- node[label=above:1] {} (sink) -- node[label=above:1] {} (seven) -- node[label=right:20] {} (three) -- node[label=above:20] {} (source) -- node[label=above:1] {} (four) -- node[label=right:1] {} (eight) -- node[label=above:20] {} (sink) -- node[label=above:1] {} (nine) -- node[label=right:1] {} (five) -- node[label=above:20] {} (source);
  \draw (two)  -- node[label=above:1] {} (three) -- node[label=above:20] {} (four) -- node[label=above:20] {} (five);
  \draw (six) -- node[label=above:20] {} (seven) -- node[label=above:1] {} (eight) -- node[label=above:20] {} (nine);
  \draw [red] (source) -- (four) -- (eight) --  (seven) -- (sink);
\end{tikzpicture}
\end{center}

\end{document}

感谢致敬!

答案1

您必须将minimum size=<length>键设置为与最大圆一样大的值,然后所有圆都将具有此大小:

 \documentclass[12pt]{article}
 \usepackage{graphicx}
 \usepackage{subfigure}
 \usepackage{amsmath}
 \usepackage{amsfonts}

 \usepackage{tikz}
 \usetikzlibrary{positioning}

\begin{document}
\begin{tikzpicture}
  \begin{scope}[auto,%
  every node/.style={draw,fill=gray!40,circle,minimum size=4em},node distance=2cm]
  % the vertices
  \node[label=left:Source] (source) at (0,0) {1*/0};
  \node[above left=of source] (three) {3*/20};
  \node[left=of three] (two) {2*/20};
  \node[above right=of source] (four) {4*/1};
  \node[right=of four] (five) {5*/20};
  \node[above=of two] (six) {6*/21};
  \node[above=of three] (seven) {7*/3};
  \node[above=of four] (eight) {8*/2};
  \node[above=of five] (nine) {9*/21};
  \node[above right=of seven,label=right:Sink] (sink) {11*/4};
  \end{scope}
  % the edges
  \draw (source) -- node[label=above:20] {} (two) -- node[label=right:1] {} (six) -- node[label=above:1] {} (sink) -- node[label=above:1] {} (seven) -- node[label=right:20] {} (three) -- node[label=above:20] {} (source) -- node[label=above:1] {} (four) -- node[label=right:1] {} (eight) -- node[label=above:20] {} (sink) -- node[label=above:1] {} (nine) -- node[label=right:1] {} (five) -- node[label=above:20] {} (source);
  \draw (two)  -- node[label=above:1] {} (three) -- node[label=above:20] {} (four) -- node[label=above:20] {} (five);
  \draw (six) -- node[label=above:20] {} (seven) -- node[label=above:1] {} (eight) -- node[label=above:20] {} (nine);
  \draw [red] (source) -- (four) -- (eight) --  (seven) -- (sink);
\end{tikzpicture}
\end{document}

结果

相关内容