2 # Take a tree described by weighted edges (on stdin), producing
3 # a png render (on stdout). Uses a text file taken as a parameter
4 # for labelling the nodes.
10 open my $f, "'"$1"'" or die "$!";
11 while (<$f>) { chomp; push @l, $_; print "$#l [label=\"$_\"]"; }
14 chomp; my ($w, $a, $b) = split / /;
15 printf "\"%d\" -- \"%d\" [w=%f, label=\"%.3f\"]\n", $a, $b, $w, $w;