Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
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 surveying the Monastery: (7)
As of 2014-09-17 00:03 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    How do you remember the number of days in each month?











    Results (54 votes), past polls