Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
PerlMonks  

Re: how to convert two lists into adjacency matrix

by linuxer (Deacon)
on Apr 13, 2009 at 21:59 UTC ( #757293=note: print w/ replies, xml ) Need Help??


in reply to how to convert two lists into adjacency matrix

Please have a look at How do I compose an effective node title? and at Markup in the Monastery.

Don't misuse <pre>-Tags here.

To your question: you're telling what you have as data source and what the desired result should look like.

But you don't show where you have your problems...

So, where's your problem hidden? What do you have problems with?

Are you looking for someone to write your code?

Update: You could do something like this (if you want to do it on your own):

  • read data
    • read data file and ignore header line
    • chomp and split each line into two pieces
    • create an entry in a hash-of-hash (HoH); $hash{id1}->{id2} = 1;
    • store id2 in an array if not already in that array
  • output:
    • for each key in %hash print that key; check for every entry in your array if an entry in the HoH exists, if so, print 1, if not, print 0.


Comment on Re: how to convert two lists into adjacency matrix
Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others lurking in the Monastery: (7)
As of 2014-12-19 05:10 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Is guessing a good strategy for surviving in the IT business?





    Results (70 votes), past polls