Skip to contents

This function computes the matrix of pairwise distances between all the elements of the two samples put together. The cardinality of the fist sample is denoted by \(n_1\) and that of the second one is denoted by \(n_2\).

Usage

dist_nvd(
  x,
  y = NULL,
  representation = "adjacency",
  distance = "frobenius",
  matching_iterations = 0,
  target_matrix = NULL
)

Arguments

x

A base::list of igraph::igraph objects or matrix representations of underlying networks from a given first population.

y

A base::list of igraph::igraph objects or matrix representations of underlying networks from a given second population.

representation

A string specifying the desired type of representation, among: "adjacency", "laplacian", "modularity" or "graphon". Default is "laplacian".

distance

A string specifying the chosen distance for calculating the test statistic, among: "hamming", "frobenius", "spectral" and "root-euclidean". Default is "frobenius".

matching_iterations

An integer value specifying the maximum number of runs when looking for the optimal permutation for graph matching. Defaults to 0L in which case no matching is done.

target_matrix

A square numeric matrix of size n equal to the order of the graphs specifying a target matrix towards which the initial doubly stochastic matrix is shrunk each time the graph matching algorithm fails to provide a good minimum. Defaults to NULL in which case the target matrix is automatically chosen between the identity matrix or the uniform matrix on the n-simplex.

Value

A matrix of dimension \((n_1+n_2) \times (n_1+n_2)\) containing the distances between all the elements of the two samples put together.

Examples

gnp_params <- list(p = 1/3)
k_regular_params <- list(k = 8L)
x <- nvd(model = "gnp", n = 10L, model_params = gnp_params)
y <- nvd(model = "k_regular", n = 10L, model_params = k_regular_params)
dist_nvd(x, y, "adjacency", "spectral")
#>            1         2         3         4         5         6         7
#> 2  1.6182188                                                            
#> 3  2.3346721 1.8292590                                                  
#> 4  1.1531221 1.5285844 2.5969306                                        
#> 5  0.8849856 1.2821958 2.2823249 1.0825085                              
#> 6  1.1944673 1.2631468 2.4347225 1.1013615 1.1837482                    
#> 7  1.4816634 1.6130956 2.7044969 1.1519232 1.4293345 1.1551931          
#> 8  1.2675737 1.6677161 2.7477164 1.1587275 1.0161804 1.4433108 1.7222259
#> 9  1.5200807 2.2334176 3.3293784 1.2728087 1.5360785 1.5198496 1.5080376
#> 10 1.1989887 1.8202534 2.7900044 1.2341221 1.4323267 1.2228828 1.2262272
#> 11 1.3799029 1.2210804 2.2104139 1.4272643 1.2482246 1.3794947 1.5615544
#> 12 1.5065074 1.4035111 2.4710310 1.3771665 1.3514119 1.4426534 1.7548539
#> 13 1.4777033 1.2213123 2.0421018 1.5941241 1.2728615 1.4757652 1.6173610
#> 14 1.6664067 1.5421312 2.5617738 1.6018197 1.6861799 1.3584400 1.2822114
#> 15 1.4427592 1.1229369 2.1406727 1.3791808 1.2686269 1.1478232 1.4754556
#> 16 1.4327936 1.4111002 2.4645590 1.3333968 1.2160554 1.3709074 1.3885566
#> 17 1.4648136 1.2742107 2.2761069 1.4325438 1.2693468 1.3526787 1.5062059
#> 18 1.5270568 1.4930275 2.3607668 1.6232515 1.3603132 1.5680684 2.0364625
#> 19 1.3928919 1.5892228 2.3596383 1.5310815 1.2051446 1.6146943 1.8975035
#> 20 1.7283923 1.4877085 2.3210077 1.4488521 1.3263064 1.5835656 1.6908042
#>            8         9        10        11        12        13        14
#> 2                                                                       
#> 3                                                                       
#> 4                                                                       
#> 5                                                                       
#> 6                                                                       
#> 7                                                                       
#> 8                                                                       
#> 9  1.5010048                                                            
#> 10 1.4222375 1.3748589                                                  
#> 11 1.4823946 1.9455131 1.4660343                                        
#> 12 1.4864470 2.0268137 1.5520215 1.0716433                              
#> 13 1.4769877 2.0357477 1.5942977 0.8594279 1.2982404                    
#> 14 1.8755046 2.0566363 1.4582723 1.2956923 1.3396139 1.3400074          
#> 15 1.5533715 1.9264916 1.5444548 0.8429685 1.0458866 0.7268204 1.2391291
#> 16 1.4852218 1.9958873 1.5289911 0.9200683 1.0118756 1.1940376 1.1871331
#> 17 1.5338335 2.0371814 1.4846165 0.7740232 1.0488428 1.0707331 1.3950533
#> 18 1.5877497 2.1721092 1.7670378 1.1324135 0.9822233 1.3807056 1.6875522
#> 19 1.5269017 2.1036968 1.7910394 1.1033057 1.0519179 1.4021658 1.5831592
#> 20 1.4956007 2.0057310 1.7761849 1.1231756 1.1355052 1.3252517 1.6285054
#>           15        16        17        18        19
#> 2                                                   
#> 3                                                   
#> 4                                                   
#> 5                                                   
#> 6                                                   
#> 7                                                   
#> 8                                                   
#> 9                                                   
#> 10                                                  
#> 11                                                  
#> 12                                                  
#> 13                                                  
#> 14                                                  
#> 15                                                  
#> 16 1.0022083                                        
#> 17 0.8794542 0.6886927                              
#> 18 1.1450239 1.3628452 1.1477949                    
#> 19 1.2047551 0.8621763 1.0255236 1.2025500          
#> 20 1.0938690 1.0275766 0.9739499 1.2014374 1.1457005