About the parent array when the vertices of the graphs are string say

how will we mark the parent array with -1 or the leader of the set if the vertices of the graph are of string type? because array indices will always be in integers.

how will the findSet and unionset functions operate too if the vertices are of string data type?

You can use unordered maps in that case ,rest should work in the same manner