The exact tree structure is flexible ;-)  I know that sounds strange, 
but the tree is going to be rebuilt for each run from the base data - 
inefficient, but this is to create flat HTML files and speed isn't a 
factor - it can run all night for all I care and is just one output from 
the base data.
For each node in the tree, there is a value.  The child nodes are 2*n 
and 2*n + 1 of the parent node.  I.e., the root node is 1 and the child 
nodes are 2 and 3.  The child nodes of node 2 are 4 and 5 while those 
for node 3 are 6 and 7.  Each node also has an id which is keyed into 
another file.  I'm using PostgreSQL for this, although I may keep the 
tree in an array as it shouldn't go over a few hundred nodes.  I was 
thinking of the following table:
    create table tree (
    child int,     childid text,
    father int,     fatherid text,
    mother int,     motherid text
    );
The 'int' values will be the tree walking ones while the 'text' ones 
will allow me to look the individuals up in other tables.

Thanks for the reading.  I'd found that article in my search as well.  
My issue is that the output they give has the 'food' node at the top and 
not in the middle where I want it.  The reading in your second email 
(http://www.artfulsoftware.com/mysqlbook/sampler/mysqled1ch20.html) 
gives lots to mull over :-)

Does that make anything clearer?

Cheers
Kevin


Keith Allpress wrote:
> Hi Kevin
> But you state that you are not a programmer, so we need to know a bit more,
> especially what kind of representation do you have for your "btree".
> Whether the tree is balanced or not is not really of any importance to 
> the output algorithm,
> the real issue is whether or not your data is stored in an elegant 
> representation.
> Also if your data turns out not to be, it may even be worth transforming it.
> Hopefully you have a relational database at least.
> If you do, then give us the database structure, this group is pretty 
> slick with database queries.
> Meantime here is some background reading.
> http://www.sitepoint.com/article/hierarchical-data-database/
> HTH
> Keith
>
>
> KevinS wrote:
>   
>> i,
>> I'll start by saying I'm not a programmer, just someone who dabbles
>> from time to time (and have since assembly on a 6502...).
>>
>> My current 'exercise' has hit a bit of a wall.  I wish to display a
>> btree type load of data (actually a genealogy pedigree which I already
>> have loaded in a database) in the following type layout:
>>
>>       +--James Trethewy
>>    +--Richard Trethewy
>>    |  +--Mary Williams
>>    Robert Trethewy
>>    |  +--William Hawkins
>>    +--Joan Hawkins
>>
>> I can find all sorts of algorithms for outputting btrees, but not in
>> this form.  It would be easy if I knew it was a balanced tree and how
>> many levels it was, but such things aren't to be.
>>
>> Does anyone have anything that will do this?  If not, pointers to some
>> code (any language will do), or some reading I should be attending to?
>>
>> Cheers
>> Kevin
>>     


--~--~---------~--~----~------------~-------~--~----~
NZ PHP Users Group: http://groups.google.com/group/nzphpug
To post, send email to [email protected]
To unsubscribe, send email to
[email protected]
-~----------~----~----~----~------~----~------~--~---

Reply via email to