What is a menu list? :)

Its easier to wrap your head around this problem when you don't have to worry about the details of data structures, so I would use Gedcom or Tree::Simple to map relationships, and maybe Tree::Simple::View::DHTML for display. Example

#!/usr/bin/perl -- use strict; use warnings; use Tree::Simple; use Tree::Simple::View::ASCII; use Tree::Simple::View::HTML; my $VAR1 = { 'Sally Smith' => { 'parents' => [ 'Bob Smith', 'Rhonda Smith' ] + }, 'Betty Freeman' => { 'parents' => [ 'Earl Freeman', 'Harmony Ellis' +] }, 'Betty Boop' => { 'parents' => [ 'Rhonda Smith', 'Louis McFern' ] + }, }; { my %nodes; for my $child_id ( keys %$VAR1 ) { my $child = $nodes{$child_id} ||= Tree::Simple->new($child_id); for my $parent_id ( @{ $VAR1->{$child_id}{parents} } ) { my $parent = $nodes{$parent_id} ||= Tree::Simple->new($parent_id +); $parent->addChild($child); } } ## end for my $child_id ( keys...) for my $node ( values %nodes ) { if ( $node->getChildCount ) { #~ my $tv = Tree::Simple::View::ASCII ->new( $node ); #~ $tv->includeTrunk(1); #~ print $tv->expandAll(), "\n\n----\n\n"; my $tv = Tree::Simple::View::HTML->new($node); $tv->includeTrunk(1); print $tv->expandAll(), "\n\n"; } ## end if ( $node->getChildCount) } ## end for my $node ( values %nodes) }

In reply to Re: A list of parents and children. How to make a tree? by Anonymous Monk
in thread A list of parents and children. How to make a tree? by tejinashi

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.