-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()) {
+# print " considering @$edge\n";
+ 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;
+
+ my $w = $weakest[0];
+ printf "weakest defeats %d > %d\n",
+ chvab($w->[0], $w->[1]),
+ chvab($w->[1], $w->[0]);
+ foreach my $weakest (@weakest) {
+ my ($ca,$cb) = @$weakest;
+ print "weakest defeat $ca > $cb\n";
+ $defeats->delete_edge($ca,$cb);