Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?

Re^5: How to save first two columns of an array into another array

by Athanasius (Chancellor)
on Oct 03, 2012 at 03:38 UTC ( #996972=note: print w/replies, xml ) Need Help??

in reply to Re^4: How to save first two columns of an array into another array
in thread How to save first two columns of an array into another array

I can’t find any module named Graph::Subgraph on CPAN or meta::cpan. When I comment out the line use Graph::Subgraph; and run the code, I get the error you describe. The strict pragma is telling you that the syntax is wrong, so removing strict here would merely make the problem harder to identify!

I’m not sure what the code in this for loop is meant to achieve, but perhaps something as simple as

for my $src (keys %h) { $g->add_edge($src, $h{$src}); }

will do what you want? If so, that leads to another, similar, "strict refs" error in the line $allgraphs[-1]{$node} = [ @{ $h{$node} } ];. But since I don’t understand what this final for loop is doing, I’m afraid I can’t offer any help here.  :-(

Tip: In future, please show the minimum code that demonstrates the problem, and explain exactly what the code is intended to do. Comment the code liberally. See How do I post a question effectively?.

Update: Just discovered, this issue has been re-addressed in Finding connected components in a graph..

Athanasius <°(((><contra mundum

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://996972]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others scrutinizing the Monastery: (10)
As of 2016-10-25 09:11 GMT
Find Nodes?
    Voting Booth?
    How many different varieties (color, size, etc) of socks do you have in your sock drawer?

    Results (315 votes). Check out past polls.