Root: First = 1; Last = 5; Next = ; Previous = ;
1: First = 11; Last = 15; Next = 2; Previous = ;
2: First = 21; Last = 25; Next = 3; Previous = 1;
...
554: First = ; Last = ; Next = 555 ; Previous = 553;
555: First = ; Last = ; Next = ; Previous = 554;
####
push(@Children,$root->child_nodes); # could be push(@Children,$start_node_id); too, any starting point...
while(@Children)
{ $node = shift @Children;
print $node,"->";
my $Node = Node->new($node);
my $next = $Node->first;
while ($next)
{ print $next,",";
my $Child = Node->new($next);
push(@Children,$next);
$next = $Child->next();
}
print "\n";
}
####
1->11,12,13,14,15,
2->21,25,
3->31,35,
4->41,45,
5->51,55,
11->111,112,113,114,115
12->
13->
14->
15->
...