Identifying weights of the edges connecting communities in CNA

Issue #213 resolved
nikita chopra created an issue

Hi,

I would like to determine the weight of the edges between each community derived from CNA function. I have used the following function as given in the tutorial.

>net<-cna(cij)
> E(net$community.network)$weight
 [1] 0.29316819 0.46772661 0.26507721 0.14421590 0.42347011 0.63043047 0.20262199 0.63573742
 [9] 0.05965198 0.55065045 0.12526637 0.63491383 0.23984732 0.60856362 0.15387550 0.22959220

I would like to know what is the weight between community 1 and 2, 1 and 3 and so on.. I will be grateful for your help in this regard. Thank you

Comments (2)

  1. Xinqiu Yao

    Hi Nikita,

    Simply type E(net$community.network) will gives you the edges with their associated community numbers. It is displayed in the same order as above, and so easy to map each other.

    ee <- E(net$community.network)
    ee
    [1]  2  -- 1 
    [2]  10 -- 1 
    [3]  11 -- 1 
    [4]  18 -- 1 
    [5]  3  -- 2 
    [6]  4  -- 3 
    [7]  6  -- 3 
    [8]  6  -- 5 
    [9]  12 -- 6 
    [10] 12 -- 11
    [11] 13 -- 11
    [12] 14 -- 12
    [13] 15 -- 12
    
    # combine weights
    ee <- print(ee)
    cbind(ee, E(net$community.network)$weight)
                  E(net$community.network)$weight
    [1]  2  -- 1                        0.3073565
    [2]  10 -- 1                        0.4377016
    [3]  11 -- 1                        0.4585989
    [4]  18 -- 1                        0.4386618
    [5]  3  -- 2                        0.4351198
    [6]  4  -- 3                        0.6460766
    [7]  6  -- 3                        0.2383838
    [8]  6  -- 5                        0.3819986
    [9]  12 -- 6                        0.7413963
    [10] 12 -- 11                       0.1317921
    [11] 13 -- 11                       0.5379519
    [12] 14 -- 12                       0.3965952
    [13] 15 -- 12                       0.6312794
    
  2. Log in to comment