Find the Best Set of Adapters I'm trying to plug this really old phone into my computer but the phone seems to use a very obscure plug. Luckily I have some adapters. Unfortunately, I can't figure out which of them to use to connect my phone to my computer. Can you find the smallest number of adapters that can link my phone and computer?
Input
A pair of strings representing the phone and the computer's port type and a list of pairs of strings where the pair A, B transforms an input of type A to type B. Example:
(&quot;A&quot;, &quot;D&quot;)
[
  (&quot;A&quot;, &quot;B&quot;),
  (&quot;C&quot;, &quot;D&quot;),
  (&quot;B&quot;, &quot;C&quot;),
]


The first pair (&quot;A&quot;, &quot;D&quot;) is the desired connection. The rest are adapters.
Challenge
Output the number of adapters required to connect the phone to the computer. In the above example, the answer would be 3 as all 3 adapters would be required.
Test Cases
Phone, Computer
TypeA -&gt; TypeB
TypeC -&gt; TypeD
Output

A, D
A -&gt; B
B -&gt; C
C -&gt; D
3

A, Z
A -&gt; B
B -&gt; C
C -&gt; D
D -&gt; Z
X -&gt; Y
Y -&gt; Z
4

A, B
A -&gt; B
X -&gt; Y
Y -&gt; Z
1

A, C
A -&gt; B
B -&gt; C
C -&gt; A
2

A, C
A -&gt; A
B -&gt; B
C -&gt; C
A -&gt; B
B -&gt; C
2

Rules

Standard loopholes disallowed
This is code-golf, shortest code wins
You can assume it is possible to make the connection
The port on the phone and computer will not be of the same type
There may be adapters of type A -&gt; A
It is not guaranteed that all of the adapters will be possible to use
You may take input in any form that is convenient
Jelly, 13 bytes
ṗJ$Ẏy@ƒ⁼⁵ɗƇẈṂ

Try it online!
Full program taking a list of pairs L (e.g. ['AB', 'BC', 'CD', 'DZ', 'XY', 'YZ']) as the first argument, the source as the second and the target as the third.
How it works
Brute-force approach.
ṗJ$Ẏy@ƒ⁼⁵ɗƇẈṂ - Main link. Takes L on the left and S on the right
  $           - Group the previous 2 links into a monad f(L):
 J            -   Yield the indices of L; [1, 2, 3, ..., len(L)]
ṗ             -   Get the n'th Cartesian power of L for each n in this range
   Ẏ          - Flatten into a list of lists
         ɗƇ   - Keep those for which the following is true:
      ƒ       -   Reduce the list by the following, starting with S:
    y@        -     Translate, according to the pair mapping
       ⁼⁵     - Does the final result equal T?
           ẈṂ - Get the length of the shortest element