Skip to contents

Converts network to matrix

Usage

igraph2matrix(igraph_network, diagonal = 0)

Arguments

igraph_network

network object

diagonal

Numeric (length = 1). Value to be placed on the diagonal of network. Defaults to 0

Value

Returns a network in the format

Author

Hudson Golino <hfg9s at virginia.edu> & Alexander P. Christensen <alexander.christensen at Vanderbilt.Edu>

Examples

# Convert network to {igraph}
igraph_network <- convert2igraph(ega.wmt$network)

# Convert network back to matrix
igraph2matrix(igraph_network)
#>             wmt1       wmt2        wmt3       wmt4       wmt5        wmt6
#> wmt1  0.00000000 0.20504140  0.02519858 0.20950744 0.10205827 0.000000000
#> wmt2  0.20504140 0.00000000  0.36317478 0.01981004 0.23029131 0.064983548
#> wmt3  0.02519858 0.36317478  0.00000000 0.07537304 0.00000000 0.152920281
#> wmt4  0.20950744 0.01981004  0.07537304 0.00000000 0.09624515 0.067310562
#> wmt5  0.10205827 0.23029131  0.00000000 0.09624515 0.00000000 0.012703703
#> wmt6  0.00000000 0.06498355  0.15292028 0.06731056 0.01270370 0.000000000
#> wmt7  0.00000000 0.00000000  0.01471000 0.07939620 0.06342734 0.155069001
#> wmt8  0.00000000 0.02836007  0.01791868 0.07745228 0.01402051 0.106495118
#> wmt9  0.00000000 0.05348284  0.00000000 0.01824286 0.00000000 0.099829836
#> wmt10 0.05972899 0.08544266  0.05718115 0.12124044 0.03045947 0.132591941
#> wmt11 0.03925086 0.00000000  0.08817080 0.00000000 0.03334977 0.006736274
#> wmt12 0.00000000 0.00000000  0.03973018 0.00000000 0.10263701 0.001836519
#> wmt13 0.00000000 0.00000000  0.03479151 0.00000000 0.07209698 0.043306825
#> wmt14 0.00000000 0.06331114  0.00000000 0.00000000 0.00000000 0.000000000
#> wmt15 0.00000000 0.00000000  0.00000000 0.07237912 0.00000000 0.106874171
#> wmt16 0.06962695 0.00000000  0.02295917 0.00000000 0.02381512 0.024587674
#> wmt17 0.04780781 0.00000000  0.00000000 0.03412561 0.12392761 0.129182165
#> wmt18 0.00000000 0.00000000 -0.01261399 0.00000000 0.00000000 0.000000000
#>             wmt7       wmt8       wmt9       wmt10       wmt11       wmt12
#> wmt1  0.00000000 0.00000000 0.00000000 0.059728988 0.039250855 0.000000000
#> wmt2  0.00000000 0.02836007 0.05348284 0.085442664 0.000000000 0.000000000
#> wmt3  0.01471000 0.01791868 0.00000000 0.057181149 0.088170795 0.039730183
#> wmt4  0.07939620 0.07745228 0.01824286 0.121240438 0.000000000 0.000000000
#> wmt5  0.06342734 0.01402051 0.00000000 0.030459472 0.033349775 0.102637012
#> wmt6  0.15506900 0.10649512 0.09982984 0.132591941 0.006736274 0.001836519
#> wmt7  0.00000000 0.18213231 0.00000000 0.057316344 0.122658354 0.000000000
#> wmt8  0.18213231 0.00000000 0.13905307 0.000000000 0.059099440 0.118491586
#> wmt9  0.00000000 0.13905307 0.00000000 0.198544958 0.000000000 0.118482744
#> wmt10 0.05731634 0.00000000 0.19854496 0.000000000 0.075170295 0.000000000
#> wmt11 0.12265835 0.05909944 0.00000000 0.075170295 0.000000000 0.061476902
#> wmt12 0.00000000 0.11849159 0.11848274 0.000000000 0.061476902 0.000000000
#> wmt13 0.06319015 0.00000000 0.10429971 0.069530854 0.000000000 0.000000000
#> wmt14 0.12988043 0.00000000 0.19330862 0.067465168 0.000000000 0.027208487
#> wmt15 0.09319009 0.00000000 0.03740509 0.000000000 0.048902139 0.187004269
#> wmt16 0.00000000 0.04832084 0.09111490 0.084525058 0.068598913 0.000000000
#> wmt17 0.06368262 0.00000000 0.00000000 0.000000000 0.001795742 0.113771734
#> wmt18 0.00000000 0.08098444 0.00000000 0.005726423 0.075462425 0.000000000
#>            wmt13      wmt14      wmt15      wmt16       wmt17        wmt18
#> wmt1  0.00000000 0.00000000 0.00000000 0.06962695 0.047807805  0.000000000
#> wmt2  0.00000000 0.06331114 0.00000000 0.00000000 0.000000000  0.000000000
#> wmt3  0.03479151 0.00000000 0.00000000 0.02295917 0.000000000 -0.012613989
#> wmt4  0.00000000 0.00000000 0.07237912 0.00000000 0.034125613  0.000000000
#> wmt5  0.07209698 0.00000000 0.00000000 0.02381512 0.123927607  0.000000000
#> wmt6  0.04330682 0.00000000 0.10687417 0.02458767 0.129182165  0.000000000
#> wmt7  0.06319015 0.12988043 0.09319009 0.00000000 0.063682622  0.000000000
#> wmt8  0.00000000 0.00000000 0.00000000 0.04832084 0.000000000  0.080984436
#> wmt9  0.10429971 0.19330862 0.03740509 0.09111490 0.000000000  0.000000000
#> wmt10 0.06953085 0.06746517 0.00000000 0.08452506 0.000000000  0.005726423
#> wmt11 0.00000000 0.00000000 0.04890214 0.06859891 0.001795742  0.075462425
#> wmt12 0.00000000 0.02720849 0.18700427 0.00000000 0.113771734  0.000000000
#> wmt13 0.00000000 0.09209023 0.05139276 0.14834616 0.000000000  0.000000000
#> wmt14 0.09209023 0.00000000 0.13528246 0.04271463 0.042612075  0.083977048
#> wmt15 0.05139276 0.13528246 0.00000000 0.09308491 0.000000000  0.076420880
#> wmt16 0.14834616 0.04271463 0.09308491 0.00000000 0.028523364  0.106791750
#> wmt17 0.00000000 0.04261207 0.00000000 0.02852336 0.000000000  0.183194088
#> wmt18 0.00000000 0.08397705 0.07642088 0.10679175 0.183194088  0.000000000