cmp_diff, cmp_gzip: Implement naive comparators
[autophylo.git] / tree_render.sh
blobe9632dc90582d41120a868b0c242eadae0d6fcbe
1 #!/bin/sh
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.
6 cat |
7 perl -nle 'BEGIN {
8 our @l;
9 open my $f, "'"$1"'" or die "$!";
10 while (<$f>) { chomp; push @l, $_; }
11 close $f;
12 print "graph philo {";
14 chomp; my ($w, $a, $b) = split / /;
15 my $la = $a < 0 ? "$a" : $l[$a];
16 my $lb = $b < 0 ? "$b" : $l[$b];
17 printf "%s -- %s [w=%f, label=\"%.3f\"]\n", $la, $lb, $w, $w;
18 END { print "}"; }' |
19 dot -Tpng