chiark / gitweb /
delete obsolete dual-based stuff
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Tue, 26 Feb 2019 10:27:34 +0000 (10:27 +0000)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Tue, 26 Feb 2019 10:27:34 +0000 (10:27 +0000)
planar-graph does this now

parse-input-graph

index a4c46d462da268976e850c0b313e20e85a1f4e5d..f3d81d08b28c3ca641295568a7f0f0bb8a79bc5c 100755 (executable)
@@ -15,22 +15,12 @@ our %region;
 # $region{NAME}{Adj}[]{Regexp}
 # $region{NAME}{Adj}[]{Dikes}
 # $region{NAME}{Adj}[]{L}
-# %region{NAME}{Adj}[]{Vertices}[0..1] // computed by dual
 
 our %adj;
 # $adj{EARLIER}{LATER}{Dikes}
 # $adj{EARLIER}{LATER}{L}[]
 # $adj{EARLIER}{LATER}{T}[]
 
-# computed by dual()
-our @vertex;
-# $vertex[]{Text}
-# $vertex[]{EdgeIds}[]
-# $vertex[]{Edges}[]{Regions}[0..1] = NAME
-# $vertex[]{Edges}[]{VIB}
-# $vertex[]{Edges}[]{EdgeId}
-# $vertex[]{Edges}[]{Outside}
-
 sub read_in () {
   my $ccolour;
   my $cregion;
@@ -166,100 +156,6 @@ sub edge_id_to_other_id ($$) {
   confess "$ra $adjia ?";
 }
 
-sub dual () {
-  # We want to turn the graph from a graph on the regions, to
-  # one where the nodes are the vertices of region boundaries.
-  #
-  # Each adjacency in %adj has two ends, each of which is at
-  # such a vertex.  We need to identify which of these vertices
-  # are the same.  We do this by assigning an id to each vertex.
-  #
-  # This is actually a DJF, where the to-be-vertices are the connected
-  # components, and the edges indicate that two vertices are the same.
-
-  my $g = Graph::Undirected->new(unionfind => 1);
-
-  # vertex "<Region Name> # <i>" is the vertex at the
-  # anticlockwise end of the i'th listed edge of Region Name.
-
-  foreach my $ra (sort keys %region) {
-    my $adjsa = $region{$ra}{Adj};
-    foreach my $adjia (0..$#$adjsa) {
-      my ($rb, $adjib) = edge_id_to_other_id($ra, $adjia);
-      my $adjsb = $region{$rb}{Adj};
-      my $adjibc = ($adjib + 1) % @$adjsb;
-      my $adja = $adjsa->[$adjia];
-      my $va = "$ra # $adjia";
-      # $va is the vertex at the anticlockwise end
-      # of edge no.$adjia of region $ra
-      my $ra_outside = ($ra eq 'L' or $ra eq 'NZ');
-      my $rb_outside = ($rb eq 'L' or $rb eq 'NZ');
-      next if $ra_outside and $rb_outside;
-      # $rb is the region on the other side of that edge
-      my $vb = "$rb # $adjibc";
-      # $vb is the vertex at the *clockwise* end
-      # of that same edge, which is edge no.$adjibc of region $rb
-      print STDERR "vertex $va = $vb\n";
-      $g->add_edge($va,$vb);
-    }
-  }
-  my %edgeid2vi;
-  # $edgeid2vi{EDGEID} = VI   s.t.  some $vertex[VI]{EdgeIds}[][J] eq EDGEID
-  my $cci = 0;
-  foreach my $cc ($g->connected_components) {
-    print STDERR "CC $cci:\n"; $cci++;
-    print STDERR "    $_\n" foreach @$cc;
-    my %uniq;
-    foreach my $e (@$cc) {
-      $e =~ m/ \# \d+$/ or confess;
-      push @{ $uniq{$`} }, $e;
-    }
-    foreach my $u (values %uniq) {
-      next if @$u == 1;
-      my ($x,$y) = @$u or confess;
-      my @p = $g->SP_Dijkstra($x, $y);
-      confess join ' -- ', @p;
-    }
-
-    my $vertex = {
-      EdgeIds => $cc,
-      Text => (join "\n", @$cc),
-    };
-    foreach my $e (@$cc) {
-      $edgeid2vi{$e} = scalar @vertex;
-    }
-    push @vertex, $vertex;
-  }
-  foreach my $via (0..$#vertex) {
-    my $vertexa = $vertex[$via];
-    $vertexa->{Edges} = [];
-    foreach my $eid (@{ $vertexa->{EdgeIds} }) {
-      $eid =~ m/ # (\d+)$/ or confess;
-      my ($ra, $adjia) = ($`, $1);
-      my $adjsa = $region{$ra}{Adj};
-
-      my ($ro,$adjio) = edge_id_to_other_id($ra,$adjia);
-      my $ra_out = ($ra eq 'L' or $ra eq 'NZ');
-      my $ro_out = ($ro eq 'L' or $ro eq 'NZ');
-      my $is_spec = ($ra_out or $ro_out);
-      my $adjib = ($adjia + 1) % @$adjsa;
-      my $vib = $edgeid2vi{"$ra # $adjib"};
-
-      print STDERR "VIA=$via | $ra # $adjia | # $adjib VIB=$vib\n";
-      my $vertexb = $vertex[$vib];
-      confess "# $adjib $vib" unless defined $vib and defined $vertexb;
-      my $einfo = {
-        VIB => $vib,
-        EdgeId => $eid,
-        Text => "$eid\n$ro # $adjio",
-        Spec => $is_spec,
-        Outside => $ro_out,
-      };
-      push @{ $vertexa->{Edges} }, $einfo;
-    }
-  }
-}
-
 sub o { print @_ or die $!; }
 
 sub plag_prs ($) {
@@ -270,12 +166,6 @@ sub plag_prs ($) {
     return "$t";
 }
 
-sub plag_prv ($) {
-    my ($vi) = @_;
-    my $t = $vertex[$vi]{Text};
-    plag_prs($t);
-}
-
 sub output_planar_graph () {
   foreach my $ra (sort keys %region) {
     o(plag_prs($ra), "\n");
@@ -289,48 +179,9 @@ sub output_planar_graph () {
 
 }
 
-sub output_dot () {
-  o <<END;
-strict graph "map" {
-  layout="neato";
-  start=2;
-//  nodesep=20;
-//  mindist=20;
-//  maxiter=1000000000000000;
-//  epsilon=0.00000000000000001;
-  //splines=true;
-  node [
-    shape=circle;
-    fixedsize=true;
-    fontsize=8;
-  ];
-END
-  foreach my $via (0..$#vertex) {
-    my $vertexa = $vertex[$via];
-    o("$via [label=\"".$vertexa->{Text}."\"];\n");
-    foreach my $ei (@{ $vertexa->{Edges} }) {
-      my $vib = $ei->{VIB};
-      next unless $via <= $vib;
-      #if ($r1 eq 'NZ' || $r1 eq 'L') {
-      #  $r1n = "_$r1 $r0";
-      #  next;
-      #}
-      #next if $ei->{Spec};
-      o "\"$via\" -- \"$vib\" [";
-      o " weight=0.00001, w=0.00001, len=5," if $ei->{Spec};
-      o "fontsize=8, label=\"".
-         $ei->{Text}."\",";
-      o "];\n";
-    }
-  }
-  o "}\n";
-}
-
 read_in();
 resolve_arefs();
 adjacencies();
-#dual();
-#output_dot();
 output_planar_graph();
 
 # Local variables: