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
oftidygraph::tbl_graph
objects or matrix representations of underlying networks from a given first population.- y
A
base::list
oftidygraph::tbl_graph
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 toNULL
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(n = 24L, p = 1/3)
degree_params <- list(out_degree = rep(2, 24L), method = "configuration")
x <- nvd(sample_size = 10L, model = "gnp", !!!gnp_params)
#> ℹ Calling the `tidygraph::play_gnp()` function with the following arguments:
#> • n: 24
#> • p: 0.333333333333333
#> • directed: TRUE
#> • loops: FALSE
y <- nvd(sample_size = 10L, model = "degree", !!!degree_params)
#> ℹ Calling the `tidygraph::play_degree()` function with the following arguments:
#> • out_degree: 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, …, 2, and 2
#> • method: configuration
#> • in_degree: NULL
dist_nvd(x, y, "adjacency", "spectral")
#> 1 2 3 4 5 6 7
#> 2 1.3247846
#> 3 1.0327248 0.9033180
#> 4 1.5853265 1.6640296 1.7191641
#> 5 0.9666449 1.4355136 1.2589486 1.3497579
#> 6 1.8110275 1.5013356 1.8511752 1.2436566 1.4344913
#> 7 1.3930286 1.4059886 1.5364497 1.1343736 1.0990257 0.9076238
#> 8 1.2303792 1.5106096 1.4119224 1.6730651 1.3688597 1.6864406 1.2009165
#> 9 1.1101856 1.2287318 1.3380202 1.5881906 0.9484409 1.3067718 0.9976968
#> 10 2.1893772 2.0652489 2.3058835 1.4329811 2.1422303 1.4517239 1.5917795
#> 11 8.4867947 8.5608153 8.7547574 7.4780207 8.2803750 7.4567586 7.7232314
#> 12 8.4422768 8.5215249 8.7216879 7.4711314 8.2429917 7.4256876 7.7030848
#> 13 8.3326960 8.4244411 8.6346130 7.2954696 8.0754004 7.2667769 7.5421763
#> 14 8.5346271 8.6472123 8.8305416 7.5621490 8.3493604 7.5456648 7.7836831
#> 15 8.4507363 8.5152352 8.7053939 7.4405549 8.2445197 7.4250752 7.6844996
#> 16 8.5612955 8.6429671 8.8154116 7.6008036 8.3980884 7.5923383 7.8293452
#> 17 8.7016700 8.7882495 8.9736385 7.7333608 8.5226313 7.6957167 7.9396531
#> 18 8.5984466 8.6848386 8.8748586 7.6466974 8.4189707 7.6032316 7.8775459
#> 19 8.5142376 8.6069190 8.7932205 7.5435473 8.3396354 7.5338812 7.7876685
#> 20 8.7145670 8.8895109 9.0224292 7.8085073 8.5666788 7.8687106 8.0494336
#> 8 9 10 11 12 13 14
#> 2
#> 3
#> 4
#> 5
#> 6
#> 7
#> 8
#> 9 1.1048100
#> 10 2.0321761 2.1846303
#> 11 8.3134499 8.4229044 6.6444501
#> 12 8.2746230 8.3994799 6.6304228 0.7369126
#> 13 8.1406785 8.2364872 6.5535510 1.2683823 1.3336147
#> 14 8.3549279 8.4946292 6.7359199 0.9783101 1.1464892 1.0788921
#> 15 8.2628771 8.3869980 6.6250181 0.7239710 0.6074279 1.3083881 1.1218164
#> 16 8.3952254 8.5488617 6.7202718 0.6934316 0.8810910 1.6705284 1.0485169
#> 17 8.5071303 8.6499853 6.8451125 1.1513150 1.5204346 1.6132610 1.0345899
#> 18 8.4544076 8.5696768 6.7655138 0.5638243 0.7853323 1.5476022 1.0788974
#> 19 8.3476217 8.4767803 6.6939736 0.5954485 0.6107754 1.4131486 0.9632040
#> 20 8.5461863 8.7305567 7.0410593 2.0052855 2.0542314 2.0288872 1.6862530
#> 15 16 17 18 19
#> 2
#> 3
#> 4
#> 5
#> 6
#> 7
#> 8
#> 9
#> 10
#> 11
#> 12
#> 13
#> 14
#> 15
#> 16 0.9222237
#> 17 1.5016252 1.1529340
#> 18 0.9899725 0.6758305 1.1875108
#> 19 0.5506270 0.7299532 1.3193354 0.6945410
#> 20 1.9859817 2.0844278 2.3432337 1.9666672 1.8500806