1. Could you please explain me this part of the code posted by anonymous
for my $triplet ( @S ){ my %Pie; undef @Pie{@$QT}; delete @Pie{ @$triplet }; print "@$triplet\n" if keys(%Pie) <= ( @$QT - @$triplet ) ;
2. If I call this code as a subroutine,how do I save the retun value of this subroutine.
But I want to save the return value "b c a"sub induced { my (@z)=@_; for my $QT (\@z ){ #print Dumper $QT; for my $triplet ( @trip ){ my %Pie; undef @Pie{@$QT}; delete @Pie{ @$triplet }; print "@$triplet\n" if keys(%Pie) <= ( @$QT - @$triplet ) ; return @$triplet; } }} my @C; my $d; my $p=$#subgraphs+1; for ($d=$p; $d >=1; $d--) { print "component $d = @{ $subgraphs[$d-1] }\n"; my ($qw,$we,$er)=&induced(@{ $subgraphs[$d-1] }); } ----------OUTPUT------------ component 2 = e d component 1 = c a b b c a
In reply to Re^2: Finding subgraphs induced by a set of given vertices.
by zing
in thread Finding subgraphs induced by a set of given vertices.
by zing
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |