in reply to Re: Finding subgraphs induced by a set of given vertices.
in thread Finding subgraphs induced by a set of given vertices.
Hi Lanx,
I have two questions:-
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
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^3: Finding subgraphs induced by a set of given vertices.
by Anonymous Monk on Oct 04, 2012 at 02:48 UTC | |
by AnomalousMonk (Archbishop) on Oct 04, 2012 at 16:07 UTC | |
by Anonymous Monk on Oct 04, 2012 at 18:31 UTC | |
by Anonymous Monk on Oct 04, 2012 at 03:01 UTC |
In Section
Seekers of Perl Wisdom