Perl-Sensitive Sunglasses PerlMonks

Re^3: Finding subgraphs induced by a set of given vertices.

 on Oct 05, 2012 at 20:07 UTC ( #997538=note: print w/replies, xml ) Need Help??

I hope I was clear explaining my problem. Please let me know if you need any other information. Help me on his
• Comment on Re^3: Finding subgraphs induced by a set of given vertices.

Replies are listed 'Best First'.
Re^4: Finding subgraphs induced by a set of given vertices.
by zing (Beadle) on Oct 06, 2012 at 08:24 UTC
Guys the problem is like to check if an array is contained inside another array.
```perl -le '@x = qw(a b c d e f);
@y = qw(a d f);
\$n = grep { \$e = \$_; not grep { \$e =~ /\Q\$_/i } @x } @y;
print "Count of elements in (@y) that are NOT present in (
+@x) = \$n"
'
Count of elements in (a d f) that are NOT present in (a b c d e f) = 0
So if the count is 0, you know that @y is a subset of @x and hence you want to return it from the "induced" subroutine. I hope this would even clear out the mess. Now can this be incorporated as a subroutine. The input will be DATA taken in as an array. The second array will hold the connected components.
```____DATA_____
b c a
a c d
d e b
e f g
g d f
h i g
@Components
```a b c
a b d c
e f d g
So I want to see if any row of @DATA is contained inside @Components. So the output expected is
```component 1 = a b c
induced = b c a
component = a b d c
induced = b c a
a c d
component 3 = e f d g
induced = e f g
g d f

Create A New User
Node Status?
node history
Node Type: note [id://997538]
help
Chatterbox?
 LanX ... on monster.com [r@j]: # list all of a user's processes my \$process_java = \$lConfig_Hash{\$MFT _CMD."_java"}; my \$Process = find_proc(user=>' raj', detail=>1) || die "Sorry, \$Process_java is not running" ; if(proc_exists( name=>'\$Process_ja va')){ [LanX]: see SOPW [r@j]: guys i am begginer on perl and above code is not working on window environment.kindly suggest which support on both window and Unix environment [holli]: And I kindly suggest you post a question, instead of spamming the chetterbox

How do I use this? | Other CB clients
Other Users?
Others chilling in the Monastery: (13)
As of 2017-10-23 15:29 GMT
Sections?
Information?
Find Nodes?
Leftovers?
Voting Booth?
My fridge is mostly full of:

Results (280 votes). Check out past polls.

Notices?