Web Analytics Made Easy -
StatCounter formatting into adjacency matrix - CodingForum

Announcement

Collapse
No announcement yet.

formatting into adjacency matrix

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • formatting into adjacency matrix

    I have parsed and formatted data into the following format:

    Code:
    Sample1 | 10010001111001010110100111111000011101100001111010011011111100110111111101000011
    Sample2 | 10110000101000000110110110111011111100100011110011011011111100110111111101000010
    Sample3 | 10110011101100110110110110111000011100100011110011011011111110110111111101000010
    Sample4 | 11110010101010000110100110111000011100110001111010011011111110111111111101000010
    Sample5 | 10110010101000100110100110111110011100100001111110011011111100110111111101001010
    The 0's and 1s just mean true or false for each corresponding sample. Here is the challenge. I need to construct an adjacency matrix from this information with 0,1,2,...,90 being the row and column headers (or nodes) and the samples are the "edges." So if a sample has a "1" associated with a position (or node) that position or node will be "connected" to all other nodes that have a 1 as well. For example lets say we have:

    Sample1 | 0100
    Sample2 | 1100
    Sample2 | 1001

    The output of the script should be:
    Code:
       0  1  2  3
    0  0  1  0  1
    1  1  0  0  0
    2  0  0  0  0
    3  1  0  0  0
    Does this make sense? Can anyone please help me out? Been struggling for awhile on this problem. Thanks.

    -N

  • #2
    Lets see what you have tried so far.

    Comment

    Working...
    X