Saturday, 15 February 2014

hadoop - creating adjacency list in Pig -


I'm new to pigs Can anyone tell me how this can be done? I have a text file with an Axiom matrix:

  * x1 x2 x3 x4 x5 x1 0 1 0 1 1 x2 0 0 1 0 x3 0 0 0 0 1 x4 0 0 0 0 0 X5 0 1 0 0 0  

I want to create a proximity list with this matrix that should look like this

  x1x2x1x4x1x5x2x4x3 X5, x5, x2, x3, x4, x5, x5, x2, x5 x2  

So I read the matrix from the file: A = LOAD 'matrix.txt' is used by PigStorage ('\ T ') AS (x, x1, x2, x3, x4, x5); Therefore, now Dump A

  (*, x1, x2, x3, x4, x5) (x1,0,1,0,1,1) (x2,0,0,0,1, 1 , 0) (x3,0,0,0,0,1) (x4,0,0,0,0,0,0,0) (x5,0,1,0,0,0)  

Now I want to create a group that maps every X1, X2, X3, X4, X5 to the first column of at least one 1 next column

< P> Any help appreciated!


No comments:

Post a Comment