Are these states connected? With the US election going on right now, I noticed that there is one (completely meaningless, but still) thing which Trump can still achieve and which is out of reach for Biden: Having the won states being connected.
Task: Given a list of strings of two-letter abbreviations (see below) for US states, determine whether they are connected. That is, is the graph whose edges are the states in this list and where two edges are connected whenever the corresponding states are neighbors to each other connected? That is, for each two states, does there exist a path (in this graph) from one to another?
On Githhub, ubikuity has compiled a list of neighboring US states, which I copy here for convenience:
AK,WA
AL,FL
AL,GA
AL,MS
AL,TN
AR,LA
AR,MO
AR,MS
AR,OK
AR,TN
AR,TX
AZ,CA
AZ,CO
AZ,NM
AZ,NV
AZ,UT
CA,HI
CA,NV
CA,OR
CO,KS
CO,NE
CO,NM
CO,OK
CO,UT
CO,WY
CT,MA
CT,NY
CT,RI
DC,MD
DC,VA
DE,MD
DE,NJ
DE,PA
FL,GA
GA,NC
GA,SC
GA,TN
IA,IL
IA,MN
IA,MO
IA,NE
IA,SD
IA,WI
ID,MT
ID,NV
ID,OR
ID,UT
ID,WA
ID,WY
IL,IN
IL,KY
IL,MO
IL,WI
IN,KY
IN,MI
IN,OH
KS,MO
KS,NE
KS,OK
KY,MO
KY,OH
KY,TN
KY,VA
KY,WV
LA,MS
LA,TX
MA,NH
MA,NY
MA,RI
MA,VT
MD,PA
MD,VA
MD,WV
ME,NH
MI,OH
MI,WI
MN,ND
MN,SD
MN,WI
MO,NE
MO,OK
MO,TN
MS,TN
MT,ND
MT,SD
MT,WY
NC,SC
NC,TN
NC,VA
ND,SD
NE,SD
NE,WY
NH,VT
NJ,NY
NJ,PA
NM,OK
NM,TX
NM,UT
NV,OR
NV,UT
NY,PA
NY,VT
OH,PA
OH,WV
OK,TX
OR,WA
PA,WV
SD,WY
TN,VA
UT,WY
VA,WV

To be clear, “to be a neighbor of” is symmetric and hence the entry AK,WA means that AK neighbors WA and that WA neighbors AK. There might be some disagreement whether some of these states are indeed neighbors of each other but for the purpose of this question, let us go with the list above. (Although that would mean that Trump needs to lose Alaska in order to have his won states connected.)
Input: A list of two-letter strings or something equivalent such as a single string consisting of a series of two-letter pairs such as &quot;AK WA OR&quot; or &quot;AKWAOR&quot;. It may be assumed that each string is one of the two-letter abbreviations in the list above and that no string appears more than once in the list.
Output: Return/Ouput a truthy value if the states are connected and a falsey value if they are not.
(Very!) simple test cases:

[] is connected.

[&quot;AK&quot;] is connected.

[&quot;AK&quot;, &quot;WA&quot;, &quot;OR&quot;] is connected.

[&quot;UT&quot;, &quot;CO&quot;, &quot;WY&quot;, &quot;KS&quot;, &quot;NM&quot;] is connected. (That is, they form a connected graph although they do not form a “line” of neighboring states.)

[&quot;AK&quot;, &quot;OR&quot;] is not connected.

[&quot;ID&quot;, &quot;OR&quot;, &quot;WA&quot;, &quot;AL&quot;, &quot;GA&quot;, &quot;TN&quot;] is not connected.


Standard I/O rules apply and standard loopholes are forbidden.
This is code-golf, so shortest code in bytes wins.
Wolfram Language (Mathematica), 169 167 bytes
ConnectedGraphQ@Subgraph[Cases[#[v=&quot;StateAbbreviation&quot;]&amp;/@#@&quot;BorderingStates&quot;#@v&amp;/@Interpreter[&quot;USState&quot;]@#|&quot;CA&quot;&quot;HI&quot;|&quot;AK&quot;&quot;WA&quot;/.&quot;MI&quot;&quot;MN&quot;|&quot;NY&quot;&quot;RI&quot;-&gt;0,a_ b_:&gt;a&lt;-&gt;b,3],#]&amp;

Try it online!
TIO doesn't have data sets downloaded, so most of the footer is to ensure the code works as if they had been.
The BorderingStates properties differ from the given list of adjacencies in four ways: HI and AK do not border any other states, MI borders MN, and NY borders RI.
Interpreter[&quot;USStates&quot;]@#           (* get Entitys corresponding to abbreviations *)
#@&quot;BorderingStates&quot;                 (* for each state, get a list of bordering states, *)
#[v=&quot;StateAbbreviation&quot;]&amp;/@ % #@v&amp;  (* pair it (unordered) with each of those and convert back to abbreviations. *)
% /@ %%% |&quot;CA&quot;&quot;HI&quot;|&quot;AK&quot;&quot;WA&quot;         (* append CA-HI and AK-WA, *)
% /.&quot;MI&quot;&quot;MN&quot;|&quot;NY&quot;&quot;RI&quot;-&gt;0            (* discard MI-MN and NY-RI, *)
Cases[ % ,a_ b_:&gt;a&lt;-&gt;b,3]           (* then get all pairs and convert them to edges. *)
ConnectedGraphQ@Subgraph[ % ,#]&amp;    (* is the subgraph consisting of input states connected? *)



There's also GraphData[&quot;ContiguousUSAGraph&quot;], which is missing AK-WA, AZ-CO, CA-HI, and NM-UT edges. Unfortunately, the vertices are numbered in what seems to be an arbitrary order.