One of the requirement of Kruskal algorithm is to first initialize an empty set for the vertices but I'm having issues with it.
If i were to have a graph represented by
[1,2,4]
[10,3,5]
[6,1,3]
where the first index value is the source vertex, and the second value is the destination vertex and the third value is the weight, how would i initiate the empty set for the vertex?
I tried something like:
v_set = [0] * 11
but I'm limiting the vertex to only up to 11 hence if there was a vertex of 12 for example, it would produce an index out of range error. Would appreciate some help on this.