# ComputeM: Compute score matrix M In GraphAlignment: GraphAlignment

## Description

Compute the score matrix M.

## Usage

 ```1 2``` ```ComputeM(A, B, R, P, linkScore, selfLinkScore, nodeScore1, nodeScore0, lookupLink, lookupNode, clamp=TRUE) ```

## Arguments

 `A` adjacency matrix for network A `B` adjacency matrix for network B `R` node similarity matrix `P` permutation vector to be used as the initial alignment (see InitialAlignment) `linkScore` link score matrix (see ComputeLinkParameters) `selfLinkScore` self link score matrix (see ComputeLinkParameters) `nodeScore1` node score vector (s1) (see ComputeNodeParameters) `nodeScore0` node score vector for unaligned nodes (s0) (see ComputeNodeParameters) `lookupLink` link bin lookup table (see GetBinNumber) `lookupNode` node bin lookup table (see GetBinNumber) `clamp` clamp values to range when performing bin lookups

## Details

This function computes the score Matrix M from the network adjacency matrices A and B, the node similarity matrix R, an alignment P (given as a permutation vector) and the node and link scores with their associated binning information. The alignment P is either generated by the previous iterative step, or, initially, by using InitialAlignment. The matrix M is then given to the linear assignment solver to compute the new alignment.

## Value

The return value is the score matrix M.

## Author(s)

Joern P. Meier, Michal Kolar, Ville Mustonen, Michael Laessig, and Johannes Berg

## Examples

 ``` 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17``` ``` ex<-GenerateExample(dimA=22, dimB=22, filling=.5, covariance=.6, symmetric=TRUE, numOrths=10, correlated=seq(1,18)) pinitial<-InitialAlignment(psize=34, r=ex\$r, mode="reciprocal") lookupLink<-seq(-2,2,.5) linkParams<-ComputeLinkParameters(ex\$a, ex\$b, pinitial, lookupLink) lookupNode<-c(-.5,.5,1.5) nodeParams<-ComputeNodeParameters(dimA=22, dimB=22, ex\$r, pinitial, lookupNode) ComputeM(A=ex\$a, B=ex\$b, R=ex\$r, P=pinitial, linkScore=linkParams\$ls, selfLinkScore=linkParams\$ls, nodeScore1=nodeParams\$s1, nodeScore0=nodeParams\$s0, lookupLink=lookupLink, lookupNode=lookupNode) ```

### Example output

```           [,1]       [,2]       [,3]        [,4]        [,5]         [,6]
[1,] 10.387629 -1.0613582 -6.5060461  -4.3980171  -4.0901323  -9.85218370
[2,] -5.338024 12.1041263 -5.1399544  -3.7599297  -2.8436390  -6.37209812
[3,] -5.022060 -4.1010097 11.6468105  -2.5134363  -2.9834400  -4.26437381
[4,] -4.786377 -0.3824488 -0.1749002   8.1916867  -1.9761384  -2.66928557
[5,] -2.689488 -4.0852614 -1.2937152  -2.0371631   9.8110199  -2.68948828
[6,] -5.545308 -2.5102640 -1.9523100  -5.0566119  -3.1657615   8.12280569
[7,] -6.326822 -4.8917372 -2.7243453  -2.2055516  -0.4783306  -1.75926445
[8,] -7.216224 -7.8324097 -2.9300787  -2.2840232  -5.3380244  -3.09049904
[9,] -5.074059 -3.5054429 -4.0555799  -1.7938168   1.0621144  -3.09049904
[10,] -5.984080 -5.6476077 -4.1451921  -7.1016129  -6.8784694  -2.34229208
[11,] -1.602203 -5.1527916 -4.8416977 -10.4071898  -6.0551493  -6.05514928
[12,] -5.430883 -5.2580403 -4.7000863  -5.4435342  -5.9135378  -0.01157354
[13,] -0.756720 -5.7768341 -3.8971242  -2.9665957  -3.4365993  -5.22835881
[14,] -2.499689 -1.9400735 -3.6189209  -0.2284475  -1.4969588  -5.01469401
[15,] -2.911536 -3.6629520 -1.5062841  -1.4813223  -3.5607639  -3.74308544
[16,] -9.261374 -6.6380650 -4.0494596  -0.1357381  -7.9709614  -9.41552467
[17,] -9.671863 -3.1678748 -3.7085331  -2.1556655  -3.3125467  -1.13401425
[18,] -4.972169 -7.7542361 -8.3249924  -8.0938807 -10.9842525 -10.06796174
[19,] -6.182299 -4.5240711 -2.0689971  -0.4515910  -3.7932743  -1.26754564
[20,] -7.311009 -2.7165633  0.5494409  -1.2926193  -3.5356902  -0.84633218
[21,] -4.572861  0.3279592  0.3750875  -3.1409491  -2.0015148  -3.38153957
[22,] -5.537942 -3.0042453 -3.6094422  -3.2542778  -6.0205969  -3.84206445
[23,]  0.000000  0.0000000  0.0000000   0.0000000   0.0000000   0.00000000
[24,]  0.000000  0.0000000  0.0000000   0.0000000   0.0000000   0.00000000
[25,]  0.000000  0.0000000  0.0000000   0.0000000   0.0000000   0.00000000
[26,]  0.000000  0.0000000  0.0000000   0.0000000   0.0000000   0.00000000
[27,]  0.000000  0.0000000  0.0000000   0.0000000   0.0000000   0.00000000
[28,]  0.000000  0.0000000  0.0000000   0.0000000   0.0000000   0.00000000
[29,]  0.000000  0.0000000  0.0000000   0.0000000   0.0000000   0.00000000
[30,]  0.000000  0.0000000  0.0000000   0.0000000   0.0000000   0.00000000
[31,]  0.000000  0.0000000  0.0000000   0.0000000   0.0000000   0.00000000
[32,]  0.000000  0.0000000  0.0000000   0.0000000   0.0000000   0.00000000
[33,]  0.000000  0.0000000  0.0000000   0.0000000   0.0000000   0.00000000
[34,]  0.000000  0.0000000  0.0000000   0.0000000   0.0000000   0.00000000
[,7]       [,8]        [,9]       [,10]       [,11]       [,12]
[1,] -7.23374565  -9.206165  -5.8331016  -7.1048221  -3.4442628 -7.71337736
[2,] -4.25500696 -11.738163  -4.5708599  -8.6841620  -4.5035637 -7.09549266
[3,] -2.14728265  -3.436033  -5.8551196  -4.3697343  -0.9512761 -4.98776835
[4,]  1.05724350  -3.400082  -1.8426070  -3.3781811  -5.2818687 -1.78324220
[5,] -4.54268903  -4.231215  -1.4085544  -8.8727531  -5.4749142 -7.38317473
[6,]  2.15151333  -3.134418  -4.4280032  -2.9520967  -6.3566526  2.90402531
[7,]  7.27063690  -3.965968   1.4613099  -5.1699406  -5.4704599 -1.97183337
[8,] -4.14519209   9.650563  -1.8785581  -2.7540268  -5.1653676 -1.00048286
[9,] -1.98240800  -3.533614   6.2018573  -7.7634169  -8.2367790 -5.66392195
[10,] -2.75889773  -5.396293  -5.7153186  11.1232970  -7.1914112 -4.50077114
[11,] -6.35842624  -7.108181 -10.1997946 -10.6635286   1.1104573 -5.10456739
[12,]  1.76459103  -2.227756  -4.8149255  -4.4376313  -6.9353752  3.99300953
[13,] -1.33820032  -6.092687  -2.3379871  -2.4715184  -9.5273409 -3.08007373
[14,] -0.02592322  -4.870022  -0.1752030  -7.3267578  -4.5919681 -2.86640892
[15,] -1.11516866  -3.334448  -4.8230056  -3.7588338  -6.1920391 -2.85704207
[16,] -2.13043840  -3.527493  -4.0006695  -5.6433027 -10.2550404 -7.26723958
[17,] -0.11553538  -3.474249  -0.4408671   0.2666298  -9.9141139 -2.95602108
[18,] -8.67218864  -5.160760  -9.5979581  -1.1717758  -7.9117452 -8.89423630
[19,]  1.52400057  -1.023783  -2.6946620  -2.3819063  -8.2745779 -0.21787285
[20,]  0.68297232  -4.225665  -3.9569037  -4.3215468  -2.1966736  0.03971119
[21,] -2.36306069  -7.207160  -4.2978303  -5.8176561  -2.9588136 -5.20354640
[22,]  0.04809405  -7.578072  -2.0503050   0.6878432  -9.2396588 -1.69377937
[23,]  0.00000000   0.000000   0.0000000   0.0000000   0.0000000  0.00000000
[24,]  0.00000000   0.000000   0.0000000   0.0000000   0.0000000  0.00000000
[25,]  0.00000000   0.000000   0.0000000   0.0000000   0.0000000  0.00000000
[26,]  0.00000000   0.000000   0.0000000   0.0000000   0.0000000  0.00000000
[27,]  0.00000000   0.000000   0.0000000   0.0000000   0.0000000  0.00000000
[28,]  0.00000000   0.000000   0.0000000   0.0000000   0.0000000  0.00000000
[29,]  0.00000000   0.000000   0.0000000   0.0000000   0.0000000  0.00000000
[30,]  0.00000000   0.000000   0.0000000   0.0000000   0.0000000  0.00000000
[31,]  0.00000000   0.000000   0.0000000   0.0000000   0.0000000  0.00000000
[32,]  0.00000000   0.000000   0.0000000   0.0000000   0.0000000  0.00000000
[33,]  0.00000000   0.000000   0.0000000   0.0000000   0.0000000  0.00000000
[34,]  0.00000000   0.000000   0.0000000   0.0000000   0.0000000  0.00000000
[,13]      [,14]      [,15]       [,16]        [,17]      [,18]
[1,] -2.14312627 -0.1187445 -8.6078036  -5.0066091  -6.87555824  -7.161579
[2,] -6.80781059 -0.1940070 -7.6534466  -6.7400997  -4.05097022 -12.459896
[3,] -4.98776835 -1.9024239 -0.6496609  -6.2512920  -7.02162886  -7.936258
[4,] -1.11826589  0.2034899 -2.6883924  -0.8400626  -0.01965361  -7.909785
[5,] -5.61958614  1.0682347 -4.3949940  -4.6669278  -4.77228828  -8.102831
[6,] -1.79706340 -2.0847455 -0.6591397  -8.7944676  -1.62422059  -9.553664
[7,] -4.17853669 -2.8567808 -5.2378376  -4.9989456  -2.74345216 -10.044287
[8,] -5.91523638 -6.6178623 -4.8950957  -4.6355845  -1.02068557  -3.918874
[9,] -1.95442321 -0.2177235 -5.4704599  -4.5665916  -2.46524884  -8.330999
[10,] -2.73718255 -7.5829432  0.3561301  -7.5465756  -1.81292365  -2.216727
[11,] -8.40988300 -3.1178352 -6.7611337 -10.1747536 -12.20733210  -8.359431
[12,] -2.18398571 -4.8325218 -4.5055283  -9.1813899  -2.01114289  -8.464680
[13,]  6.79694150 -2.3555833 -3.6380277  -6.7044514  -1.14364232  -5.399955
[14,] -2.71225824  0.9703516 -7.3946548  -3.3785165  -2.53941543  -9.503778
[15,]  1.26740052 -0.2825233  0.2080997  -4.1205658  -2.01922295  -5.013293
[16,] -7.11308890 -5.7913331 -8.9238059   3.9678991  -4.06856646  -7.226266
[17,] -5.16272440 -6.2018226 -2.2517334  -4.2195448   2.95070224  -7.983952
[18,] -7.13064771 -9.7791838 -6.5805107  -3.8266141  -5.69556318   2.883259
[19,] -0.06372217 -2.7122582 -1.8744391  -4.1894467   0.10912064  -6.344416
[20,] -3.26560442 -2.4546742 -1.4532257  -6.2927167  -3.09276160  -8.447686
[21,] -7.41024972 -0.3451346 -3.4006464  -3.4317610  -3.26711499 -11.330090
[22,]  0.06980922 -4.9395809 -3.3503456  -4.2195448   1.34126433 -10.181177
[23,]  0.00000000  0.0000000  0.0000000   0.0000000   0.00000000   0.000000
[24,]  0.00000000  0.0000000  0.0000000   0.0000000   0.00000000   0.000000
[25,]  0.00000000  0.0000000  0.0000000   0.0000000   0.00000000   0.000000
[26,]  0.00000000  0.0000000  0.0000000   0.0000000   0.00000000   0.000000
[27,]  0.00000000  0.0000000  0.0000000   0.0000000   0.00000000   0.000000
[28,]  0.00000000  0.0000000  0.0000000   0.0000000   0.00000000   0.000000
[29,]  0.00000000  0.0000000  0.0000000   0.0000000   0.00000000   0.000000
[30,]  0.00000000  0.0000000  0.0000000   0.0000000   0.00000000   0.000000
[31,]  0.00000000  0.0000000  0.0000000   0.0000000   0.00000000   0.000000
[32,]  0.00000000  0.0000000  0.0000000   0.0000000   0.00000000   0.000000
[33,]  0.00000000  0.0000000  0.0000000   0.0000000   0.00000000   0.000000
[34,]  0.00000000  0.0000000  0.0000000   0.0000000   0.00000000   0.000000
[,19]     [,20]      [,21]      [,22] [,23] [,24] [,25] [,26] [,27]
[1,] -14.264494 -1.503377  -5.138859 -9.2914720     0     0     0     0     0
[2,]  -8.711237 -3.246346  -7.692758 -8.6735873     0     0     0     0     0
[3,]  -3.731833 -0.850940  -5.718565 -6.5658630     0     0     0     0     0
[4,]  -3.746183 -1.586608  -3.612651 -3.3613369     0     0     0     0     0
[5,]  -2.408262 -3.967664  -1.272000 -8.9612694     0     0     0     0     0
[6,]  -2.815542 -3.518168  -2.777893  2.1368609     0     0     0     0     0
[7,]  -3.801242 -7.007733  -3.213456 -2.1541549     0     0     0     0     0
[8,]  -6.240568 -3.793311  -3.004245 -2.1085739     0     0     0     0     0
[9,]  -5.266008 -4.522826   1.371512 -5.9797749     0     0     0     0     0
[10,]  -7.023327 -5.432847  -9.712685 -4.1329557     0     0     0     0     0
[11,] -10.526974 -4.397107  -6.933976 -4.3218080     0     0     0     0     0
[12,]  -6.661931 -3.403744  -3.579759  3.5135272     0     0     0     0     0
[13,]  -9.764722 -3.634855  -3.127202 -4.6581684     0     0     0     0     0
[14,]  -9.551057 -5.030628  -4.108031 -4.4445036     0     0     0     0     0
[15,]  -3.210545  0.211272  -5.197277 -4.4351367     0     0     0     0     0
[16,]  -4.912692 -7.234235  -8.508862 -5.9736546     0     0     0     0     0
[17,]  -3.309524 -7.991920  -3.003149 -4.5341157     0     0     0     0     0
[18,]  -9.247739 -5.989552 -11.745297 -9.2100892     0     0     0     0     0
[19,]  -2.932229 -3.480705  -5.429787 -0.6973552     0     0     0     0     0
[20,]  -2.511016 -3.059491  -5.172203 -2.6369958     0     0     0     0     0
[21,]  -5.557049 -5.170541  -5.934343 -6.7816411     0     0     0     0     0
[22,]  -8.378428 -7.317465  -7.657110 -3.2718740     0     0     0     0     0
[23,]   0.000000  0.000000   0.000000  0.0000000     0     0     0     0     0
[24,]   0.000000  0.000000   0.000000  0.0000000     0     0     0     0     0
[25,]   0.000000  0.000000   0.000000  0.0000000     0     0     0     0     0
[26,]   0.000000  0.000000   0.000000  0.0000000     0     0     0     0     0
[27,]   0.000000  0.000000   0.000000  0.0000000     0     0     0     0     0
[28,]   0.000000  0.000000   0.000000  0.0000000     0     0     0     0     0
[29,]   0.000000  0.000000   0.000000  0.0000000     0     0     0     0     0
[30,]   0.000000  0.000000   0.000000  0.0000000     0     0     0     0     0
[31,]   0.000000  0.000000   0.000000  0.0000000     0     0     0     0     0
[32,]   0.000000  0.000000   0.000000  0.0000000     0     0     0     0     0
[33,]   0.000000  0.000000   0.000000  0.0000000     0     0     0     0     0
[34,]   0.000000  0.000000   0.000000  0.0000000     0     0     0     0     0
[,28] [,29] [,30] [,31] [,32] [,33] [,34]
[1,]     0     0     0     0     0     0     0
[2,]     0     0     0     0     0     0     0
[3,]     0     0     0     0     0     0     0
[4,]     0     0     0     0     0     0     0
[5,]     0     0     0     0     0     0     0
[6,]     0     0     0     0     0     0     0
[7,]     0     0     0     0     0     0     0
[8,]     0     0     0     0     0     0     0
[9,]     0     0     0     0     0     0     0
[10,]     0     0     0     0     0     0     0
[11,]     0     0     0     0     0     0     0
[12,]     0     0     0     0     0     0     0
[13,]     0     0     0     0     0     0     0
[14,]     0     0     0     0     0     0     0
[15,]     0     0     0     0     0     0     0
[16,]     0     0     0     0     0     0     0
[17,]     0     0     0     0     0     0     0
[18,]     0     0     0     0     0     0     0
[19,]     0     0     0     0     0     0     0
[20,]     0     0     0     0     0     0     0
[21,]     0     0     0     0     0     0     0
[22,]     0     0     0     0     0     0     0
[23,]     0     0     0     0     0     0     0
[24,]     0     0     0     0     0     0     0
[25,]     0     0     0     0     0     0     0
[26,]     0     0     0     0     0     0     0
[27,]     0     0     0     0     0     0     0
[28,]     0     0     0     0     0     0     0
[29,]     0     0     0     0     0     0     0
[30,]     0     0     0     0     0     0     0
[31,]     0     0     0     0     0     0     0
[32,]     0     0     0     0     0     0     0
[33,]     0     0     0     0     0     0     0
[34,]     0     0     0     0     0     0     0
```

GraphAlignment documentation built on Nov. 8, 2020, 6:56 p.m.