How to denote adjacent vertices?
You could use \arrownot
from stmaryrd
; the normal \not
seems too big for a simple bar.
\documentclass{article}
\usepackage{stmaryrd} % for \arrownot
\newcommand{\notedge}{%
\mathrel{\mkern-2mu}% a small back up
\arrownot % a short slash
\mathrel{\mkern2mu}% compensate
\mathrel{-}% minus as a relation
}
\begin{document}
$u\notedge v$
\end{document}
This exploits two facts: \arrownot
has zero width and is classified as a relation symbol (it extends past its bounding box); TeX doesn't add space between consecutive relation symbols (which can also be spaces)
This is how $u\not\mathrel{-}v$
would print:
A possible alternative:
\documentclass{article}
\usepackage{centernot}
\newcommand{\notedge}{\centernot{\mathrel{-}\joinrel\mathrel{-}}}
\begin{document}
$u\notedge v$
\end{document}
Another proposal with longer symbols:
\documentclass{article}
\usepackage{stmaryrd} % for \arrownot
\newcommand{\edge}{%
\mathrel{-}% minus as a relation
\joinrel\joinrel % some backup
\mathrel{-}% minus as a relation
}
\newcommand{\notedge}{%
\mathrel{\mkern2mu}% a small advancement
\arrownot % a short slash
\mathrel{\mkern-2mu}% compensate
\edge
}
\begin{document}
$u \edge v$
$u\notedge v$
\end{document}
centernot
provides centering of \not
across lengthier symbols:
\documentclass{article}
\usepackage{centernot}% http://ctan.org/pkg/centernot
\newcommand{\adjacent}[1][.7em]{\mathrel{\rule[.5ex]{#1}{.4pt}}}
\newcommand{\notadjacent}[1][.7em]{\mathrel{\centernot{\adjacent[#1]}}}
\begin{document}
$u \adjacent v \notadjacent w \adjacent[1em] x \notadjacent[1em] y$
\end{document}
Both \adjacent[<len>]
and \nonadjacent[<len>]
take an optional argument with the defauly being .7em
.