Kwiki-MindMap
view release on metacpan or search on metacpan
lib/Kwiki/MindMap.pm view on Meta::CPAN
$graph->add_node($this_symbol, label=>'',color=>"$hue,1,1");
$graph->add_edge($parent_symbol => $this_symbol,
color => "$hue,1,1",
label => (split('/',$this_symbol))[-1],
);
return unless (ref($tree) eq 'HASH');
foreach my $kid (keys %$tree) {
$self->draw_left_kids($graph,$this_symbol, "$this_symbol/$kid", $tree->{$kid});
}
}
sub draw_right_kids {
my ($graph, $parent_symbol,$this_symbol,$tree) = @_;
$graph->add_node($this_symbol, label=>'',color=>"$hue,1,1");
$graph->add_edge($this_symbol => $parent_symbol,
color => "$hue,1,1",
label => (split('/',$this_symbol))[-1],
);
return unless (ref($tree) eq 'HASH');
foreach my $kid (keys %$tree) {
$self->draw_right_kids($graph,$this_symbol, "$this_symbol/$kid", $tree->{$kid});
}
}
sub count_kids {
my $root = shift;
return 0 unless ref($root) eq 'HASH';
my @kids = keys %$root;
my $count = @kids;
foreach my $kid (@kids) {
$count += $self->count_kids($root->{$kid});
}
return $count;
}
__END__
=head1 NAME
Kwiki::MindMap - Display what's on your mind.
=head1 DESCRIPTION
Display what's on your mind.
Thanks to dngor for providing beautiful GraphViz mindmap rendering code :)
Here's a quick example how to use this plugin after you installed it:
.mindmap
computer
* laptop
** huge
*** IBM
*** Mac
** small
*** sony
*** toshiba
* desktop
** pretty
** ugly
.mindmap
The string 'computer' means the root node, and sub-nodes are prefixed
with '*', you may use any of [*+0=] for the tree prefix.
=head1 SEE ALSO
L<Kwiki::GDGraphGenerator>, L<Kwiki::SocialMap>
=head1 COPYRIGHT
Copyright 2004,2005 by Kang-min Liu <gugod@gugod.org>.
This program is free software; you can redistribute it and/or
modify it under the same terms as Perl itself.
See <http://www.perl.com/perl/misc/Artistic.html>
=cut
( run in 0.967 second using v1.01-cache-2.11-cpan-140bd7fdf52 )