Closed gaborcsardi closed 10 years ago
In the non-weighted version this is put on the diagonal of the matrix by default: degree(graph)/(vcount(graph) - 1)
. Do you want to use graph.strength
(the sum of weights of incident edges) instead of degree
in the weighted version?
graph.strength
it is.
Hi,
I was trying to work with weighted graphs and ASE. My approach to getting the non-weighted version of ASE was to set weights=rep(1,ecount(g))
.
I was working with the graph
g <- read.graph("http://openconnecto.me/data/public/MR/MIGRAINE_v1_0/KKI-42/small_graphs_graphml/KKI-21_KKI2009-01_small_graph.graphml",format="graphml")
X1 <- adjacency.spectral.embedding(g,2,weights=rep(1,ecount(g))$X
E(g)$weight=1
X1 <- adjacency.spectral.embedding(g,2)
I got vastly different results for X1 and X2 above.
Also, this ER example gives slightly different results.
set.seed(12345)
g <- erdos.renyi.game(15,.4)
X1 <- adjacency.spectral.embedding(g,2,options= list(maxiter = 5000))
X1a <- adjacency.spectral.embedding(g,2,options= list(maxiter = 5000))
E(g)$weight = -log(runif(ecount(g)))
Xw <- adjacency.spectral.embedding(g,2)
X2 <- adjacency.spectral.embedding(g,2,weights=rep(1,ecount(g)),options= list(maxiter = 5000))
X1$X
# [,1] [,2]
# [1,] -0.1960136 0.4523541
# [2,] -0.7022076 -0.5052613
# [3,] -0.4802431 -0.6745986
# [4,] -0.4411350 -0.2387668
# [5,] -0.7248353 -0.2607279
# [6,] -0.8338896 0.1462500
# [7,] -0.8032891 0.7138957
# [8,] -0.6263277 0.4690501
# [9,] -0.6431580 -0.5757554
# [10,] -0.7885311 -0.1028077
# [11,] -0.8208309 0.1917610
# [12,] -0.8284541 0.2344697
# [13,] -0.4311922 0.5618437
# [14,] -0.5658762 -0.6231745
# [15,] -0.5692550 0.1849964
X1a$X
# [,1] [,2]
# [1,] -0.1960136 -0.4523541
# [2,] -0.7022076 0.5052613
# [3,] -0.4802431 0.6745986
# [4,] -0.4411350 0.2387668
# [5,] -0.7248353 0.2607279
# [6,] -0.8338896 -0.1462500
# [7,] -0.8032891 -0.7138957
# [8,] -0.6263277 -0.4690501
# [9,] -0.6431580 0.5757554
# [10,] -0.7885311 0.1028077
# [11,] -0.8208309 -0.1917610
# [12,] -0.8284541 -0.2344697
# [13,] -0.4311922 -0.5618437
# [14,] -0.5658762 0.6231745
# [15,] -0.5692550 -0.1849964
X2$X
# [,1] [,2]
# [1,] -0.1922274 0.4703508
# [2,] -0.7417220 -0.5701688
# [3,] -0.4547676 -0.6017120
# [4,] -0.4201575 -0.1868288
# [5,] -0.7403614 -0.2849648
# [6,] -0.8917938 0.1685238
# [7,] -0.7899966 0.7276508
# [8,] -0.5938849 0.4272288
# [9,] -0.6270755 -0.5111985
# [10,] -0.7881188 -0.1318171
# [11,] -0.8001522 0.1806378
# [12,] -0.8225983 0.2150546
# [13,] -0.4285555 0.5780003
# [14,] -0.5510811 -0.5994857
# [15,] -0.5516544 0.1856551
See #50.
From #38.