
Last chance! 50% off unlimited learning
Sale ends in
Spectral decomposition of the adjacency matrices of graphs.
embed_adjacency_matrix(graph, no, weights = NULL, which = c("lm", "la",
"sa"), scaled = TRUE, cvec = graph.strength(graph, weights =
weights)/(vcount(graph) - 1), options = igraph.arpack.default)
The input graph, directed or undirected.
An integer scalar. This value is the embedding dimension of the
spectral embedding. Should be smaller than the number of vertices. The
largest no
-dimensional non-zero singular values are used for the
spectral embedding.
Optional positive weight vector for calculating a weighted
embedding. If the graph has a weight
edge attribute, then this is
used by default. In a weighted embedding, the edge weights are used instead
of the binary adjacencny matrix.
Which eigenvalues (or singular values, for directed graphs) to use. ‘lm’ means the ones with the largest magnitude, ‘la’ is the ones (algebraic) largest, and ‘sa’ is the (algebraic) smallest eigenvalues. The default is ‘lm’. Note that for directed graphs ‘la’ and ‘lm’ are the equivalent, because the singular values are used for the ordering.
Logical scalar, if FALSE
, then
A numeric vector, its length is the number vertices in the graph. This vector is added to the diagonal of the adjacency matrix.
A named list containing the parameters for the SVD
computation algorithm in ARPACK. By default, the list of values is assigned
the values given by igraph.arpack.default
.
A list containing with entries:
Estimated latent positions,
an n
times no
matrix, n
is the number of vertices.
NULL
for undirected graphs, the second half of the latent
positions for directed graphs, an n
times no
matrix, n
is the number of vertices.
The eigenvalues (for undirected graphs) or the singular values (for directed graphs) calculated by the algorithm.
A named list, information about the underlying ARPACK
computation. See arpack
for the details.
This function computes a no
-dimensional Euclidean representation of
the graph based on its adjacency matrix,
For undirected graphs the latent positions are calculated as
no
columns of no
singular values on the
diagonal.
For directed graphs the embedding is defined as the pair
Sussman, D.L., Tang, M., Fishkind, D.E., Priebe, C.E. A Consistent Adjacency Spectral Embedding for Stochastic Blockmodel Graphs, Journal of the American Statistical Association, Vol. 107(499), 2012
# NOT RUN {
## A small graph
lpvs <- matrix(rnorm(200), 20, 10)
lpvs <- apply(lpvs, 2, function(x) { return (abs(x)/sqrt(sum(x^2))) })
RDP <- sample_dot_product(lpvs)
embed <- embed_adjacency_matrix(RDP, 5)
# }
Run the code above in your browser using DataLab