Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I was wondering how to make the vertices in my graph have the same size and those horizontal arcs to be actually horizontal:

enter image description here

Here is my code, and feel free to make any suggestion even on other issues:

 \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}

Thanks and regards!

share|improve this question
add comment

1 Answer

up vote 6 down vote accepted

You have to set the minimum size=<length> key to a value which is as large as the largest circle, then all circles will have this size:

 \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}

Result

share|improve this answer
4  
Is there a way to determine the largest size without guessing it? –  Rupert Jones Sep 1 '11 at 13:04
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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