The longest consecutive traversal possible (number of edges) A truck fleet dispatcher is trying to determine which routes are still accessible after heavy rains flood certain highways. During their trips, trucks must follow linear, ordered paths between 26 waypoints labeled A through Z; in other words, they must traverse waypoints in either standard or reverse alphabetical order.
The only data the dispatcher can use is the trip logbook, which contains a record of the recent successful trips. The logbook is represented as a list of strings, where each string (corresponding to one entry) has two characters corresponding to the trip origin and destination waypoints respectively.
If the logbook contains a record of a successful trip between two points, it can be assumed that the full path between those points is accessible. Note that logbook entries imply that both directions of the traversal are valid. For example, an entry of RP means that trucks can move along both R --&gt; Q --&gt; P and P --&gt; Q --&gt; R. Note that the trips  A --&gt; B and C -&gt; D do not together imply that B -&gt; C is usable. Entries can have the same character twice, such as C -&gt; C, but this indicates no paths.
Given an array of logbook entries, your task is to write a function to return the length of the longest consecutive traversal possible; in other words, compute the maximum number of consecutive edges known to be safe. (In even more formal terms, compute the diameter of the largest tree on this graph.)
Example
For logbook = [&quot;BG&quot;, &quot;CA&quot;, &quot;FI&quot;, &quot;OK&quot;], the output should be 8
Because we can get both from A to C and from B to G, we can thus get from A to G. Because we can get from F to I and access I from G, we can therefore traverse A --&gt; I. This corresponds to a traversal length of 8 since 8 edges connect these 9 waypoints. O through K is a length 4 traversal. These two paths are disjoint, so no longer consecutive paths can be found and the answer is 8.

Guaranteed constraints:
1 ≤ logbook.length ≤ 100,
logbook[i].length = 2,
logbook[i][j] ∈ ['A'..'Z'].

Test Cases:
logbook: [&quot;AZ&quot;]
Output:25
logbook: [&quot;AB&quot;, &quot;CD&quot;]
Output:1
logbook: [&quot;BG&quot;,  &quot;CA&quot;,  &quot;FI&quot;,  &quot;OK&quot;]
Output: 8
logbook: [&quot;KM&quot;,  &quot;SQ&quot;,  &quot;ON&quot;,  &quot;XM&quot;,  &quot;UK&quot;]
Output:13
logbook: [&quot;XU&quot;,  &quot;WY&quot;,  &quot;ZD&quot;,  &quot;HH&quot;,  &quot;BK&quot;,  &quot;LG&quot;]
Output: 24
logbook: [&quot;QR&quot;,  &quot;PC&quot;,  &quot;TK&quot;,  &quot;OE&quot;,  &quot;YQ&quot;,  &quot;IJ&quot;,  &quot;HB&quot;]
Output: 23
logbook: [&quot;MG&quot;,  &quot;QQ&quot;,  &quot;JV&quot;,  &quot;IZ&quot;,  &quot;SQ&quot;,  &quot;PN&quot;,  &quot;TI&quot;,  &quot;NK&quot;]
Output: 19
logbook: [&quot;II&quot;,  &quot;ZW&quot;,  &quot;CI&quot;,  &quot;DT&quot;,  &quot;IM&quot;,  &quot;II&quot;,  &quot;TR&quot;,  &quot;XO&quot;,  &quot;AL&quot;]
Output: 25

The input will always be an array of strings, each of which has exactly two characters corresponding to the trip origin and destination waypoints respectively. The characters will always be letters, in a consistent case of your choice. The input will never contain more than 100 pairs.
Your program should output the longest consecutive traversal possible (number of edges) given the input.
This is code-golf so the shortest code in bytes wins
APL (Dyalog Unicode), 17 bytes

≢⍉↑⊆⍨∨/≠/∨⍀⎕a∘.=⎕

Try it online!