Relational approach
You describe it as relation between unlockers and unlocked similar as in this tutorial. I suggest learning more about relational algebra and databases. They are nice way how to model data. If You learn how to query the information from database You can model data quite easily.
I don't know how much You know about modeling relations. That tutorial should help You with it.
One solution
I assume that WoW work as in reality (ehm), that it is
- talent unlocks several (other) talents
- talent is unlocked by several (other) talents.
It is N:N relation, which implies You need "middle man" a new relation between the two talents:
(talent who unlocks id, talent who is unlocked)
This way You can have talent A unlocking B, C and D ((A, B), (A,C),(A,D)) and talent Y unlocked by X,Z and W ((X,Y),(Z,Y), (W,Y)). In imperative/procedural/object-oriented language You would do it as list/array of pairs like there:
var unlocks_unlocked = [[A, B],[A,C],[A,D],[X,Y],[Z,Y],[W,Y]];
So for "real-world" example You can have:
... ["running fast", "jumping superhigh"], ["antigravity's child", "jumping superhigh"]
and it means that "jumping superhigh" is obtained after You have "running fast" and "antigravity's child" talents.
Other solution
I have not played Diablo recently but it might be, that it had only:
- talent unlocks several other talents
- talent is unlocked just by one talent.
It is 1:N relation:
You put "is unlocked by this talent's id" variable into talent's structure
like:
var Talent[8] = { "name": "superpower", "unlocked by": "being Clark Kent"};