Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
PerlMonks  

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

by Athanasius (Monsignor)
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


Comment on Re^5: How to save first two columns of an array into another array
Select or Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others pondering the Monastery: (6)
As of 2014-07-26 11:30 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My favorite superfluous repetitious redundant duplicative phrase is:









    Results (175 votes), past polls