My question is that creating a uniqe code for the data which has direct relation, and through that direct relation other indirect relation is created for the first and last one. All in all if there such a case I want to assign a unique for the one which has direct and indirect realtion. Below you may find a basic dataset.
Product References Unique Key
A 1 A1
A 2 A1
A 3 A1
A a A1
A b A1
A c A1
B 1 A1
B 4 A1
B 5 A1
B x A1
B y A1
B z A1
C 6 A1
C 7 A1
C 8 A1
C x A1
C f A1
C h A1
D 12 A2
D 13 A2
D 14 A2
D 15 A2
D 16 A2
D 17 A2
D 18 A2
F 13 A2
F AB A2
F FF A2
F NB A2
F 45 A2
F 63 A2
F 100 A2
F 98 A2
F FGA A2
F CA A2
As you may see A has A relation with B but not with C. But B has a relation with C. In this case actually A and C is also related. And the en d of the dat Iwant to assing a key to those products.
And you may consider data consists of millions of row and each time a new relation is found a new iteration should run.
Explain problem, knowledge request, coding and library recommandations. How to create algortihm.