views:

100

answers:

2

I'm looking for [free] server software to store hierarchal data efficiently. My key challenge is that an object or group of objects almost always has 2 "parents" and one or both parents can have different connections with other parents, and those descendants must remain distinct from the common parent's other descendants.

Example:

A and B
    C
    D
    E and F
        G
        H
    E and I
        J
        K
L and M
    ...

I guess the gotcha will probably be that I'd strongly prefer to use this with PHP, but I'm open to learning a new language, as this is a personal project without any deadline. (I'm using a Linux server; I'm not willing to change that)

Edit: To clarify my example - C, D and E are all direct descendants of both A and B, F and I are descendants of something else, possibly the same thing, possibly not, G and K are both direct descendants of both E and F, etc.

+5  A: 
Mark Rushakoff
Thanks for the great answer - not whatt I'm looking for for this project, but I'll definitely be able to use it. In my example, C, D and E are all *direct* descendants of both A and B (F and I are descendants of something else, possibly the same thing, not necessarily though). Sorry for the lack of clarity.
Shadow
I should say, rather, that this *may* not be what I'm looking for.
Shadow
+1 for the dedication in your answer
Matias
If you think of "A and B" as the pair (A,B), then you could model it as a graph whose nodes can be pairs. Then you could use any graph-library you want.
Kim
+2  A: 

I think should be easier to write your own php classes, wich will be much more suitable for your needs. Maybe something like this (pseudocode)

Class Item  
  [List of Item] Parents 
  [List of Item] Children

The challenge is to write the methods to manage /build up the complete structure. Persisting also the level nbr should help a lot in your case. You already have related questions in stackoverflow about saving hierarchical structures into a database.

Matias