Question

I have adapted the state example (code below). What I would like to know is how to get the X to fall on the loop over node A, or by some other method to show that this path is precluded by being "exed" out. Thank you.

\begin{figure}[ht!]
\centering
\tikzpicture[->,>=stealth',shorten >=1pt,auto,node distance=2.8cm,semithick]
\tikzstyle{every state}={fill=black!30, draw = none, text = white]

\node[state] (A) {$N_1$};
\node[state] (B) [right of = A] {$N_2$};
\node[state] (C) [below of = B] {$N_3$};
\node[state] (D) [left of  = C] {$N_4$};

\path (A) edge [anchor=center,loop above] node {x} (A)
edge node {} (B)
edge node {} (C)
edge node {} (D);

\path (B) edge node {} (C)
edge node {} (D)
edge node {} (A);

\path (C) edge node {} (D)
edge node {} (A)
edge node {} (B);

\path (D) edge node {} (A)
edge node {} (B)
edge node {} (C);

\endtikzpicture
\caption{\label{fig:hop} Here is caption.}
\end{figure}
Was it helpful?

Solution

If you change loop above to loop that works for me, although it gives a much bigger loop. You can adjust the size of the loop, and IMHO the loop was too small if you wanted it x'ed out anyway. I'm not sure what size you were seeing however since you didn't include your preamble etc.

Another, rather ugly, way is to use something like node[above=-7pt] but that would require a lot of fiddling to get a good looking distance.

You might also consider using $\times$ instead of x since it looks more like an x.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top