my %winode2lines;
my %wiccix2arch;
my $wialldists;
+my %wtisland2arch;
my $dbdists= Graph::Undirected->new();
my %dbisland2arch;
foreach my $arch (sort keys %{ $oceans{$ocean} }) {
foreach my $islename (sort keys %{ $oceans{$ocean}{$arch} }) {
my $islenode= $wiisland2node{$islename};
- defined $islenode or
+ if (!defined $islenode) {
error("island $islename in source-info but not in WP map");
+ next;
+ }
my $ccix= $wiarchs->connected_component_by_vertex($islenode);
my $oldarch= $wiccix2arch{$ccix};
- error("island $islename in $arch in source-info".
- " connected to $oldarch as well")
+ error("island in $arch in source-info".
+ " connected to $oldarch as well: $islename")
if defined $oldarch && $oldarch ne $arch;
printf DEBUG "%-5s force-island-arch cc%-2d %-10s %s\n",
$islenode, $ccix, $arch, $islename;
}
}
foreach my $island (sort keys %wiisland2node) {
+ my $wtarch= $wtisland2arch{$island};
+ my $wiarch= wiisland2arch($island);
+ if (!defined $wtarch) {
+ error("island from chart not found on ocean page: $island");
+ } elsif (defined $wiarch and $wtarch ne $wiarch) {
+ error("island in $wtarch on ocean page but".
+ " concluded $wiarch from chart: $island");
+ }
+
my $dbarch= $dbisland2arch{$island};
if (!defined $dbarch) {
my $wiarch= wiisland2arch($island);
change("island new in $wiarch: $island");
}
}
+ foreach my $island (sort keys %wtisland2arch) {
+ my $node= $wiisland2node{$island};
+ next if defined $node;
+ error("island on ocean page but not in chart: $island");
+ }
}
sub shortest_path_reduction ($$) {
$wispr= shortest_path_reduction('wi',$base);
}
+sub yppedia_ocean_fetch () {
+ open OCEAN, '-|', "./yppedia-ocean-scraper", $ocean or die $!;
+ my $arch;
+ while (<OCEAN>) {
+ chomp;
+ if (m/^ocean /) {
+ $' eq $ocean or die;
+ } elsif (m/^ /) {
+ die unless defined $arch;
+ $wtisland2arch{$'}= $arch;
+ } elsif (m/^ /) {
+ $arch= $';
+ } else {
+ die;
+ }
+ }
+ $?=0; $!=0; close OCEAN; $? and die $?; $! and die $!;
+}
+
sub compare_distances () {
foreach my $ia (sort keys %dbisland2arch) {
my $na= $wiisland2node{$ia};
progress("setting archs from nearby"); yppedia_archs_fillbynearest();
progress("computing yppedia spr"); yppedia_graph_spr();
+progress("fetching yppedia ocean text"); yppedia_ocean_fetch();
+
progress("comparing islands"); compare_island_lists();
progress("comparing distances"); compare_distances();