swh:1:snp:c3e60ef3910bf67fe880e1cb5fc8a4d005b8093a
Tip revision: 5acf83710cbd521310f3703dd22c59c1891b9574 authored by wtwhite on 16 March 2015, 06:47:49 UTC
Code for the Speedy Colorful Subtrees paper
Code for the Speedy Colorful Subtrees paper
Tip revision: 5acf837
recolour_root_vertex.pl
#!/usr/bin/perl
# Not strictly necessary but without this the size can blow up quite a bit!
binmode STDIN;
binmode STDOUT;
print scalar <>; # nVerts
print scalar <>; # nEdges
my $nCols = 0 + <>;
print $nCols + 1, "\n";
$_ = <>; # Could be known optimal objective function score, or first line of colours
if (/\A\s*\S+\s*\z/) {
print;
$_ = <>; # It was just the score; read the next line
}
#if (/\A\s*0\s+0\s*\z/) {
if (/\A\s*0\s+\d+\s*\z/) { # Recognise a root of any colour
print "0 $nCols\n"; # Line recognised; print the new colour
} else {
die "Did not recognise line $. -- expected to see '0 0', representing the root vertex coloured 0.";
}
while (<>) {
print;
}