# vim: syntax=perl

use strict;

# 2-d point domination
sub dom {
    my ($gr, %opts) = @_;
    my (@V, $v, @dom);
    @V = sort { $a->pos()->[0] <=> $b->pos()->[0] }
	values %{ $gr->cget(-vertices) };
    foreach $v (@V) {
	$v->configure(-status=>"focus");
	$gr->cget(-canvas)->set_mark(0);
	while (@dom and $dom[$#dom]->pos()->[1] <= $v->pos()->[1]) {
	    my ($t) = pop @dom;
	    $t->configure(-status=>"discard");
	    $gr->cget(-canvas)->set_mark(0);
	}
	push @dom, $v;
	$v->configure(-status=>"done");
	$gr->cget(-canvas)->set_mark(1);
    }
}

1;

