user1107367
user1107367

Reputation: 11

Build hierarchy from sets of attributes

I'm having some trouble with what I believe to be some pretty basic stuff. Nevertheless I can't seem to find anything. Probably because I'm not asking the correct question.

Let's say I have three(potentially redundant) sets of data A,B,C = (a,b,c), (a,b,d), (a,e,f).

What I need is for some tool to suggest a hierarchy for me.

Like so:

      (a)
   (b)    (ef)   
(c)   (d) 

In reality there are far more sets and ALOT of attributes within each set but they are all closely related and I don't want to manually find and build the hierarchy.

Upvotes: 1

Views: 37

Answers (1)

Sergio Tulentsev
Sergio Tulentsev

Reputation: 230461

If you want to build an hierarchy out of plain tuples, go build a tree (or, rather, a forest) out of them!

In your case tree would look like

      c
    /
   b - d
  /
a - e -f

Algorithm is trivial:

  • pick first element from the tuple
  • find top element in the forest with this value (or create one if not found)
  • pick next value from the tuple
  • find matching element among children of previously found node.
  • repeat until PROFIT

Upvotes: 1

Related Questions