Context

I personally am a fan of the Wolfram Language, especially for its symbolic notation. The Wolfram Language uses the following symbols for arcs and edges respectively:

Suppose I wish to type some Mathematica pseudo-code and use these conventions rather than their "full form" (\[DirectedEdge] and \[UndirectedEdge]).

Then I can, somewhat, recreate these icons using tikz:

\newcommand{\ue}[1]{%
\begin{tikzpicture}[#1]%
\draw[fill = black] (.25ex,.25ex) circle (.3ex);
\draw[thick] (.55ex,.25ex) -- (1.55ex,.25ex);%
\draw[fill = black] (1.85ex, .25ex) circle (.3ex);%
\end{tikzpicture}%
}

\newcommand{\de}[1]{%
\begin{tikzpicture}[#1]%
\draw[fill = black] (.25ex,.25ex) circle (.3ex);
\draw[thick, ->] (.55ex,.25ex) -- (1.85ex,.25ex);%

\end{tikzpicture}%
}


Where ue and de stand for undirected / directed edge respectively. While I would prefer to use edge and arc, arc is already taken in the namespace.

To be fair, using these symbols doesn't look like the worst thing ever seen when typeset:

\noindent\textbf{Adjacency}: if there exists an edge $e \in \mathbf{E}$, for $v_i, v_j \in \mathbf{V}$ such that $e$ is defined by $v_i$~\ue{}~$v_j$ (equivocally $v_j$ \ue{} $v_i$), then $v_i$ \& $v_j$ are said to be adjacent.


Personally, I am in favor of these symbols rather than the explicit stating of an (un)ordered set of two vertices, and walks look ok-ish as well:

Question

While these tikz drawings work in the given cases, I have noticed that in caption environments the symbols is no longer centered with the text. Further, spacing can be an issue.

How can the following be achieved?

• automatic binding (the preceding and succeeding character elements must be in the same line).

• automatic centering to the preceding / succeeding character.

• the ability to work in the math environment.

• easy scaling.

Also, you opinion about using these glyphs in general would be appreciated. Be honest, how ugly are they?

• For the second symbol you can use fdsymbol Spoons, package. There is the command \leftrightblackspoon or you can see at the link: tex.stackexchange.com/questions/74689/…. – Sebastiano Feb 6 '17 at 9:56
• @Sebastiano thank you, I wasn't aware of those glyphs, but it still isn't quite what I am looking for. – SumNeuron Feb 6 '17 at 12:02

You can combine some already existing symbols. For a relation you should put your definition in \mathrel to get the spacing right (if you prefer binary operation use \mathbin, there is a slight difference in spacing). The commands involve some spacing (\mkern) that you might have to change if you scale a lot. It seems to work for 10pt, 11pt and 12pt.

\documentclass[11pt]{article}
\usepackage[fleqn]{amsmath}%% align
\setlength\parindent{0pt}%% no indent
%% Definitions
\newcommand\de{\mathrel{\bullet\mkern-2.5mu{\rightarrow}}}
\newcommand\ue{\mathrel{\bullet\mkern-3mu{-}\mkern-3mu\bullet}}
\begin{document}
In displayed math
\begin{align}
a &\ue b\\
a &\de b
\end{align}
and inline: $v_i\ue v_j\ue v_h\ue v_k$.

\end{document}