Given a grid of logical relationships, like:
| A | B | C | D | E |
1 | 0 | 0 | 1 | 1 | 0 |
2 | 1 | 0 | 1 | 1 | 1 |
3 | 0 | 1 | 0 | 1 | 0 |
4 | 1 | 1 | 0 | 0 | 1 |
5 | 0 | 1 | 1 | 1 | 0 |
(where '0' means the relationship is not possible, and it is known each letter corresponds to a different number), it is possible to deduce that {A, E} must correspond to {2, 4}, and {B, C, D} to {1, 3, 5}. What algorithm would be able to determine that sort of decomposition efficiently for a larger grid? Or, what search terms would help find such an algorithm?
# --- #
#
# The program 'vix' I use to launch vi sessions in an xterm
#
#!/usr/bin/perl -w
my $xterm = '/usr/X11R6/bin/xterm';
my $vi = '/bin/vi';
my $single = 0;
my @xopts = qw/ -cm +cn -dc -j -s +sb -sl 0 -wf -fg white -bg black /;
my @vopts = ();
while (@ARGV && $ARGV[0] =~ /^-/) {
my $arg = shift;
last if $arg eq '--';
push(@xopts, '-iconic'), next if $arg eq '-i';
push(@vopts, '-R'), next if $arg eq '-r';
$single = 1, next if $arg eq '-s';
die "unknown option '$arg'\n";
}
@ARGV = '' unless @ARGV;
for ($single ? \@ARGV : @ARGV) {
my $pid = fork;
die "fork: $!\n" unless defined $pid;
next if $pid;
my $name = $single ? "vix session" : $_;
exec $xterm, @xopts,
-name => $name,
-title => $name,
-e => $vi, @vopts, $single ? @$_ : $_;
}
|