igraph / xdata-igraph

xdata igraph, has been merged into igraph/igraph
GNU General Public License v2.0
18 stars 3 forks source link

adjacency spectral embedding #3

Closed youngser closed 11 years ago

youngser commented 11 years ago

Here is a simple reproducible example:

set.seed(12345)

require(igraph)
pm <- cbind( c(.1, .001), c(.001, .05) )
g <- sbm.game(1000, pref.matrix=pm, block.sizes=c(300,700))

g

S <- adjacency.spectral.embedding(g,15)
head(S$D)

[1] 17.88730389 0.05800502 0.05307661 0.05305303 0.05098107 0.05005083

A <- get.adjacency(g)
asm <- svd(A)
head(asm$d)

[1] 35.70288 31.02104 11.63305 11.55728 11.42464 11.31954

I believe these two should agree?

sessionInfo()

R version 3.0.1 (2013-05-16) Platform: x86_64-apple-darwin10.8.0 (64-bit)

locale: [1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8

attached base packages: [1] stats graphics grDevices utils datasets methods base

other attached packages: [1] Matrix_1.0-12 lattice_0.20-15 igraph_0.6.999-647

loaded via a namespace (and not attached): [1] grid_3.0.1

gaborcsardi commented 11 years ago

OK, fixed. Btw. to get the same result with svd(), you need to set the diagonal of the A matrix to degree(g)/(vcount(g)-1).