From 6505fd273a20a09c3a2f0992517a6f200c3f58e0 Mon Sep 17 00:00:00 2001 From: Ian Jackson Date: Mon, 14 Jan 2019 15:53:04 +0000 Subject: [PATCH] wip break out edge_id_to_other_id --- parse-input-graph | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/parse-input-graph b/parse-input-graph index e65df41..b3dfc84 100755 --- a/parse-input-graph +++ b/parse-input-graph @@ -155,7 +155,9 @@ sub edge_id_to_other_id ($$) { foreach my $adjib (0..$#$adjsb) { my $adjb = $adjsb->[$adjib]; next unless $adjb->{Name} eq $ra; - return ($rb, $adjib); + # $adjb is the same edge seen from the other side + my $adjibc = ($adjib + 1) % @$adjsb; + return ($rb, $adjibc); } confess "$ra $adjia ?"; } @@ -179,7 +181,7 @@ sub dual () { 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 ($rb, $adjibc) = edge_id_to_other_id($ra, $adjia); my $adja = $adjsa->[$adjia]; my $va = "$ra # $adjia"; # $va is the vertex at the anticlockwise end @@ -188,11 +190,9 @@ sub dual () { ($ra eq 'L' or $ra eq 'NZ'); # $rb is the region on the other side of that edge my $adjsb = $region{$rb}{Adj}; - # $adjb is the same edge seen from the other side - my $adjibc = ($adjib + 1) % @$adjsb; my $vb = "$rb # $adjibc"; # $vb is the vertex at the *clockwise* end - # of that same edge, which is edge no $adjib of region $rb + # of that same edge, which is edge no.$adjibc of region $rb print STDERR "vertex $va = $vb\n"; $g->add_edge($va,$vb); last; -- 2.30.2