X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~yarrgweb/git?p=ypp-sc-tools.web-live.git;a=blobdiff_plain;f=yarrg%2Fyppedia-chart-parser;h=8b5c50828a4e79996f4d20dc1fbc572d3887fd9c;hp=068cd1c20e30694e3c56397cb1cbd976e274df82;hb=1debcf64da6d259d6b514e1c91d253dc011e4011;hpb=569423645a63e33b72afbc0e3bb12700c439c756 diff --git a/yarrg/yppedia-chart-parser b/yarrg/yppedia-chart-parser index 068cd1c..8b5c508 100755 --- a/yarrg/yppedia-chart-parser +++ b/yarrg/yppedia-chart-parser @@ -8,7 +8,7 @@ use Graph::Undirected; use CommodsDatabase; my $widists= Graph::Undirected->new(); -my $wiarchs= Graph::Undirected->new(unionfind => 1); +my $wiarchs= Graph::Undirected->new(); my @wiarchlabels; my %wiisland2node; my %winode2island; @@ -74,6 +74,7 @@ sub parse_yppedia_map () { $winode2island{$n}= $island; $widists->add_vertex($n); $wiarchs->add_vertex($n); +#print "\$g->add_vertex('$n');\n"; printf PO "%d,%d island %s\n", $x,$y,$island; } elsif (($solid,$x,$y,$dirn) = m/^\{\{ chart\ league((?:\ solid)?) \|(\d+)\|(\d+)\| @@ -88,6 +89,8 @@ sub parse_yppedia_map () { $widists->add_weighted_edge($nn->(), nn_xy($bx,$by), 1); $wiarchs->add_edge($nn->(), nn_xy($bx,$by)) if $solid; + $wiarchs->add_edge($nn->(), nn_xy($bx,$by)) if $solid; +#print "\$g->add_edge('".$nn->()."','".nn_xy($bx,$by)."');\n" if $solid; printf PO "%d,%d league %s %s \n", $x,$y, $solid?'solid':'dotted', $dirn; @@ -172,14 +175,14 @@ sub process_yppedia_graphs () { } sort $wiarchs->connected_component_by_index($ccix); if (exists $wiccix2arch{$ccix}) { - error("architecture determination failed:\n". + error("archipelago determination failed, wrongly merged:\n". " archipelago $arch\n". " archipelago $wiccix2arch{$ccix}\n". $desc); next; } $wiccix2arch{$ccix}= $arch; - print "$ccix $arch ::\n$desc\n"; +# print "$ccix $arch ::\n$desc\n"; } } @@ -195,8 +198,3 @@ parse_yppedia_map(); parse_database_map(); process_yppedia_graphs(); compare_island_lists(); - -printf "%d %d %d %d\n", $wiarchs->has_edge('32,17','33,18'), - $wiarchs->connected_component_by_vertex('32,17'), - $wiarchs->connected_component_by_vertex('33,18'), - $wiarchs->same_connected_components('32,17','33,18');