Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight
 
PerlMonks  

Re: Union/Intersection of Multiple Arrays

by SuicideJunkie (Vicar)
on Apr 21, 2010 at 15:32 UTC ( [id://836093]=note: print w/replies, xml ) Need Help??


in reply to Union/Intersection of Multiple Arrays

This sounds like a matter of finding the connected components of a graph. Particularly if signal strength doesn't matter except as a boolean.

Something somewhat like this:

my @networks = (); for my $device (@deviceList) { if (not defined $device->{network}) { $_->{network} = $numDisjointNetworks for BFSonConnections($device) +; #DFS works fine too $numDisjointNetworks++; } push @{$networks[$device->{network}]}, $device; }
should give you a LoL of networks and devices in them, and each device will know which network it is in.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others musing on the Monastery: (6)
As of 2024-04-23 12:14 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found