12. As shown in Figure 1, there are five cities $A, B, C, D, E$, connected by routes $\widetilde{A B}, \widetilde{A D}, \widetilde{A E}, \widetilde{B C}$, $\widetilde{B D}, \widetilde{C D}$, and $\widetilde{D E}$. Then, from city $A$ to $B$, there are ( ) different paths, requiring each path to be taken once, where each path can pass through a city multiple times.
(A) 7
(B) 9
(C) 12
(D) 16
(E) 18
12. D.

Notice that, there is only one road passing through cities $C$ and $E$. Therefore, cities $C$ and $E$ can be merged into city $D$, making Graph 1 equivalent to Graph 2.

Discussing the two scenarios based on the first direction chosen from city $A$.
(1) $A \rightarrow D$.
$$
A \rightarrow D \rightarrow A \rightarrow B \rightarrow D \rightarrow B,
$$

There are $2 \times 1 \times 2=4$ different schemes;
$$
A \rightarrow D \rightarrow B \rightarrow D \rightarrow A \rightarrow B
$$

or $A \rightarrow D \rightarrow B \rightarrow A \rightarrow D \rightarrow B$,
There are $2 \times 2 \times 2=8$ different schemes.
Thus, there are $4+8=12$ different schemes in total.
(2) $A \rightarrow B$.
$$
A \rightarrow B \rightarrow D \rightarrow A \rightarrow D \rightarrow B,
$$

There are $2 \times 2=4$ different schemes.
By the principle of addition, there are $12+4=16$ different schemes in total.