Monday, April 25, 2011

label similarity

Interesting paper

labeled graph

sequence
A: a1-x->a2-y->a3
B: b1-x->b2-y->b3-z->b4

x, y, and z are labels:

     a1 a2 a3
a1  0   x   0
a2  0   0   y
a3  0   0   0


     b1 b2 b3 b4
b1  0   x   0   0
b2  0   0   y   0
b3  0   0   0   z
b4  0   0   0   0


Kronecker matrix product B

0B   xB   0B
---------------
0B   0B   yB
---------------
0B   0B   0B


       0   x   0   0      x*0 x*x x*0 x*0               0   x   0   0          
 0*   0   0   y   0      x*0 x*0 x*y 0*0         0*   0   0   y   0     
       0   0   0   z      x*0 x*0 x*0 x*z               0   0   0   z       
       0   0   0   0      x*0 x*0 x*0 x*0               0   0   0   0      
-----------------------------------------------------------------------------------------

       0   x   0   0        0   x   0   0               y0   yx   y0   y0         
 0*   0   0   y   0    0* 0   0   y   0               y0   y0   yy   y0     
       0   0   0   z        0   0   0   z               y0   y0   y0   yz       
       0   0   0   0        0   0   0   0               y0   y0   y0   y0       
----------------------------------------------------------------------------------------
       0   x   0   0         0   x   0   0                  0   x   0   0          
 0*   0   0   y   0    0*  0   0   y   0             0*  0   0   y   0     
       0   0   0   z         0   0   0   z                  0   0   0   z       
       0   0   0   0         0   0   0   0                  0   0   0   0         
       0   x   0   0         0   x   0   0                  0   x   0   0         


results

       0   0   0   0      0  xx  0      0                0   0   0   0          
       0   0   0   0      0  0    xy    0                0   0   0   0     
       0   0   0   0      0  0    0     xz               0   0   0   0       
       0   0   0   0      0  0    0      0                0   0   0   0      
-----------------------------------------------------------------------------------------
       0   0   0   0        0   0   0   0               0   yx   0   0         
       0   0   0   0        0   0   0   0               0   0   yy   0     
       0   0   0   0        0   0   0   0               0   0   0   yz       
       0   0   0   0        0   0   0   0               0   0   0    0       
----------------------------------------------------------------------------------------
       0   0   0   0         0   0   0   0                  0   0   0   0          
       0   0   0   0         0   0   0   0                  0   0   0   0     
       0   0   0   0         0   0   0   0                  0   0   0   0       
       0   0   0   0         0   0   0   0                  0   0   0   0         

finally F=
     
       0   0   0   0      0  x    0    0                0   0   0   0          
       0   0   0   0      0  0    0    0                0   0   0   0     
       0   0   0   0      0  0    0    0                0   0   0   0       
       0   0   0   0      0  0    0    0                0   0   0   0      
-----------------------------------------------------------------------------------------
       0   0   0   0        0   0   0   0               0   0   0   0         
       0   0   0   0        0   0   0   0               0   0   y   0     
       0   0   0   0        0   0   0   0               0   0   0   0       
       0   0   0   0        0   0   0   0               0   0   0   0       
----------------------------------------------------------------------------------------
       0   0   0   0         0   0   0   0              0   0   0   0          
       0   0   0   0         0   0   0   0              0   0   0   0     
       0   0   0   0         0   0   0   0              0   0   0   0       
       0   0   0   0         0   0   0   0              0   0   0   0   

similarity edge (a1a2) - (b1b2) =1=x
similarity edge (a2a3) - (b2b3)=1 =y

comments: can the similarity be percentages? can we define a function? association rules?

similarity of pair <ai, bj> = logic similarity of <ai, bj> and neighbor similarity between ai, and bi

logic similarity of <ai, bj>= edges into the <ai, bj> +  edges out the <ai, bj>

       0   0   0   0        0  x    0    0              0   0   0   0          
       0   0   0   0        0  0    0    0              0   0   0   0     
       0   0   0   0        0  0    0    0              0   0   0   0       
       0   0   0   0        0  0    0    0              0   0   0   0      
---------------------------------------------------------------------------------------
       0   0   0   0        0   0   0   0               0   0   0   0         
       0   0   0   0        0   0   0   0               0   0   y   0              1
       0   0   0   0        0   0   0   0               0   0   0   0       
       0   0   0   0        0   0   0   0               0   0   0   0       
---------------------------------------------------------------------------------------
       0   0   0   0        0   0   0   0              0   0   0   0          
       0   0   0   0        0   0   0   0              0   0   0   0     
       0   0   0   0        0   0   0   0              0   0   0   0       
       0   0   0   0        0   0   0   0              0   0   0   0   

============================================
                                    1
How to get <a2, b2>=2 ? 



col of <a2, b2> : indegree =1
row of <a2, b2>: outdegree =1

F+Ft

       0   0   0   0        0  x    0    0              0   0   0   0          
       0   0   0   0        0  0    0    0              0   0   0   0     
       0   0   0   0        0  0    0    0              0   0   0   0       
       0   0   0   0        0  0    0    0              0   0   0   0      
---------------------------------------------------------------------------------------
       0   0   0   0        0   0   0   0               0   0   0   0         
       x   0   0   0        0   0   0   0               0   0   y   0              1
       0   0   0   0        0   0   0   0               0   0   0   0       
       0   0   0   0        0   0   0   0               0   0   0   0       
---------------------------------------------------------------------------------------
       0   0   0   0        0   0   0   0              0   0   0   0          
       0   0   0   0        0   0   0   0              0   0   0   0     
       0   0   0   0        0   y   0   0              0   0   0   0       
       0   0   0   0        0   0   0   0              0   0   0   0   

============================================


The result is the column vector of the similarity matrix S (row by row)
     b1 b2 b3 b4
a1
a2
a3

The column vector is [a1b1, a1b2, a1b3, a1b4, a2b1, a2b2, a2b3,a2b4,a3b1,a3b2,a3b3,a3b4]
=[1,0,0,0,0,2,0,0,0,0,1,0 ]