in reply to Finding subgraphs induced by a set of given vertices.
induced? You mean included
#!/usr/bin/perl -- use strict; use warnings; use Data::Dump; my @S = do { open my($data), '<', \q{b c a a c d d e b}; map { [ split ] } readline $data; }; dd \@S; for my $QT ( [qw[ a b c d ]], [qw[ b e d ]] ){ dd $QT; for my $triplet ( @S ){ my %Pie; undef @Pie{@$QT}; delete @Pie{ @$triplet }; #~ warn scalar keys %Pie ; #~ warn scalar @$QT; print "@$triplet\n" if keys(%Pie) <= ( @$QT - @$triplet ) ; } } __END__ [["b", "c", "a"], ["a", "c", "d"], ["d", "e", "b"]] ["a" .. "d"] b c a a c d ["b", "e", "d"] d e b
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Finding subgraphs induced by a set of given vertices.
by remiah (Hermit) on Oct 04, 2012 at 07:52 UTC | |
|
Re^2: Finding subgraphs induced by a set of given vertices.
by zing (Beadle) on Oct 03, 2012 at 20:16 UTC |