Creating Family Tree Realtion using PHP and MySQL

Questions about the MySQL, PostgreSQL, and most other databases, as well as using it with PHP can be asked here.

Moderator: General Moderators

Post Reply
jawa007
Forum Newbie
Posts: 3
Joined: Tue Oct 31, 2006 4:09 am

Creating Family Tree Realtion using PHP and MySQL

Post by jawa007 »

Hi Everybody,

I am on a project, where I have to display a Family Tree structure (A HIRERCHICAL structure). Primarily I have started with "Adjacency List Model" and also with the B-Tree PreOrder traversing. But Both concepts require a unique root and its corresponding children. But these concepts are not meeting with my client details.

As per my client details, there should be different node for MOTHER as well as for FATHER, and under these two nodes, their coressponding siblings(childrens) should be displayed(On the other hand, the B-Tree structure requires only one root(either MOTHER or FATHER) ).

Therefore, I am finding myself in trouble.

If somebody outhere can design or explain table structure in MySQL to overcome to this issue.

Thanks in advance.
User avatar
CoderGoblin
DevNet Resident
Posts: 1425
Joined: Tue Mar 16, 2004 10:03 am
Location: Aachen, Germany

Post by CoderGoblin »

Can't you use the "root" but just hide it as a root type (flag in the database ?). Any Route node would never be shown/processed.
jawa007
Forum Newbie
Posts: 3
Joined: Tue Oct 31, 2006 4:09 am

Post by jawa007 »

CoderGoblin wrote:Can't you use the "root" but just hide it as a root type (flag in the database ?). Any Route node would never be shown/processed.
Hi Goblin.

I will try with your given idea. But can u give me an idea how many relation(s) will it require to implement the above mentioned concept. As far as my knowledge, It will require 3 Relations(Tables).
[which is quite contrary to my client, that he is saying that it should be implement under one Relation, which I think its not going to be possible ].

Anyways Thanks, coming with more.

Bye.
Post Reply