+sub find_node_with_name {
+ my ($node, $name) = @_;
+
+ return $node if ($node->{name} eq $name);
+ for my $child (@{$node->{nodes}}) {
+ my $res = find_node_with_name($child, $name);
+ return $res if defined($res);
+ }
+ return undef;
+}
+
+my $start = shift;
+my $root;
+if ($start) {
+ # Find the specified node in the tree
+ $root = find_node_with_name($tree, $start);
+} else {
+ $root = $tree;
+}
+dump_node($root);
+say $tmp "draw(n" . $root->{id} . ", (0, 0));";