EVOLUTION-MANAGER
Edit File: embed_adjacency_matrix.html
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><title>R: Spectral Embedding of Adjacency Matrices</title> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <link rel="stylesheet" type="text/css" href="R.css" /> </head><body> <table width="100%" summary="page for embed_adjacency_matrix {igraph}"><tr><td>embed_adjacency_matrix {igraph}</td><td style="text-align: right;">R Documentation</td></tr></table> <h2>Spectral Embedding of Adjacency Matrices</h2> <h3>Description</h3> <p>Spectral decomposition of the adjacency matrices of graphs. </p> <h3>Usage</h3> <pre> 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 ) </pre> <h3>Arguments</h3> <table summary="R argblock"> <tr valign="top"><td><code>graph</code></td> <td> <p>The input graph, directed or undirected.</p> </td></tr> <tr valign="top"><td><code>no</code></td> <td> <p>An integer scalar. This value is the embedding dimension of the spectral embedding. Should be smaller than the number of vertices. The largest <code>no</code>-dimensional non-zero singular values are used for the spectral embedding.</p> </td></tr> <tr valign="top"><td><code>weights</code></td> <td> <p>Optional positive weight vector for calculating a weighted embedding. If the graph has a <code>weight</code> edge attribute, then this is used by default. In a weighted embedding, the edge weights are used instead of the binary adjacencny matrix.</p> </td></tr> <tr valign="top"><td><code>which</code></td> <td> <p>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.</p> </td></tr> <tr valign="top"><td><code>scaled</code></td> <td> <p>Logical scalar, if <code>FALSE</code>, then <i>U</i> and <i>V</i> are returned instead of <i>X</i> and <i>Y</i>.</p> </td></tr> <tr valign="top"><td><code>cvec</code></td> <td> <p>A numeric vector, its length is the number vertices in the graph. This vector is added to the diagonal of the adjacency matrix.</p> </td></tr> <tr valign="top"><td><code>options</code></td> <td> <p>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 <code><a href="arpack.html">igraph.arpack.default</a></code>.</p> </td></tr> </table> <h3>Details</h3> <p>This function computes a <code>no</code>-dimensional Euclidean representation of the graph based on its adjacency matrix, <i>A</i>. This representation is computed via the singular value decomposition of the adjacency matrix, <i>A=UDV^T</i>.In the case, where the graph is a random dot product graph generated using latent position vectors in <i>R^{no}</i> for each vertex, the embedding will provide an estimate of these latent vectors. </p> <p>For undirected graphs the latent positions are calculated as <i>U[no] sqrt(D[no])</i>, where <i>U[no]</i> equals to the first <code>no</code> columns of <i>U</i>, and <i>sqrt(D[no])</i> is a diagonal matrix containing the top <code>no</code> singular values on the diagonal. </p> <p>For directed graphs the embedding is defined as the pair <i>U[no] sqrt(D[no])</i> and <i>V[no] sqrt(D[no])</i>. (For undirected graphs <i>U=V</i>, so it is enough to keep one of them.) </p> <h3>Value</h3> <p>A list containing with entries: </p> <table summary="R valueblock"> <tr valign="top"><td><code>X</code></td> <td> <p>Estimated latent positions, an <code>n</code> times <code>no</code> matrix, <code>n</code> is the number of vertices.</p> </td></tr> <tr valign="top"><td><code>Y</code></td> <td> <p><code>NULL</code> for undirected graphs, the second half of the latent positions for directed graphs, an <code>n</code> times <code>no</code> matrix, <code>n</code> is the number of vertices.</p> </td></tr> <tr valign="top"><td><code>D</code></td> <td> <p>The eigenvalues (for undirected graphs) or the singular values (for directed graphs) calculated by the algorithm.</p> </td></tr> <tr valign="top"><td><code>options</code></td> <td> <p>A named list, information about the underlying ARPACK computation. See <code><a href="arpack.html">arpack</a></code> for the details.</p> </td></tr> </table> <h3>References</h3> <p>Sussman, D.L., Tang, M., Fishkind, D.E., Priebe, C.E. A Consistent Adjacency Spectral Embedding for Stochastic Blockmodel Graphs, <em>Journal of the American Statistical Association</em>, Vol. 107(499), 2012 </p> <h3>See Also</h3> <p><code><a href="sample_dot_product.html">sample_dot_product</a></code> </p> <h3>Examples</h3> <pre> ## 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) </pre> <hr /><div style="text-align: center;">[Package <em>igraph</em> version 1.3.5 <a href="00Index.html">Index</a>]</div> </body></html>