I'm working on building a graph for word ladder problem using Python. I try to use union-find data structure to find connected component in the graph, but since I'm new to programming, I feel very confused how to implement it in Python even I have known how the union-find data structure works theoretically. Need help. Providing code would be much appreciated. The following is my data file:
{aaron
aback
abaft
abase
abash
abate
abbey
abbot
abeam
abele
abets
abhor
abide
abies
abler
abode
abomb
abort
about
above
abuse
abuzz
abyss
accra
acers
ached
aches
acids
acorn
acres
acrid
acted
actor
acute
adage
adapt
added
adder
addle
adept
adhoc
adieu
adios
adlib
adman
admen
admin
admit
admix
adobe
adopt
adore
adorn
adult
aegis
aeons
aesop
affix
afire
afoot
afros
after
again
agape
agave}