-foreach my $edge (@{ $schwartz->edges() }) {
- if (!@weakest) {
- # no weakest edges yet
- } elsif (weaker($edge, $weakest[0])) {
- # this edge is weaker than previous weakest, start new set
- @weakest = ();
- } elsif (weaker($weakest[0], $edge)) {
- # weakest edge is weaker than this one, ignore this one
- next;
- } else {
- # weakest edge is exactly as weak as this one, add this one
+ foreach my $edge (@{ $schwartz->edges() }) {
+ if (!@weakest) {
+ # no weakest edges yet
+ } elsif (weaker($edge, $weakest[0])) {
+ # this edge is weaker than previous weakest, start new set
+ @weakest = ();
+ } elsif (weaker($weakest[0], $edge)) {
+ # weakest edge is weaker than this one, ignore this one
+ next;
+ } else {
+ # weakest edge is exactly as weak as this one, add this one
+ }
+ push @weakest, $edge;
+ }
+
+ last unless @weakest;
+
+ printf "weakest defeats %d > %d",
+ (scalar @{ $vab[$_->[0]][$_->[1]]) },
+ (scalar @{ $vab[$_->[1]][$_->[0]]) };
+ foreach my $weakest (@weakest) {
+ my ($ia,$ib) = @$weakest;
+ print "weakest defeat $choices[$ia] > $choices[$ib]\n";
+ $defeats->delete_edge($ia,$ib);