EVOLUTION-MANAGER
Edit File: spectrum.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: Eigenvalues and eigenvectors of the adjacency matrix of a...</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 spectrum {igraph}"><tr><td>spectrum {igraph}</td><td style="text-align: right;">R Documentation</td></tr></table> <h2>Eigenvalues and eigenvectors of the adjacency matrix of a graph</h2> <h3>Description</h3> <p>Calculate selected eigenvalues and eigenvectors of a (supposedly sparse) graph. </p> <h3>Usage</h3> <pre> spectrum( graph, algorithm = c("arpack", "auto", "lapack", "comp_auto", "comp_lapack", "comp_arpack"), which = list(), options = arpack_defaults ) </pre> <h3>Arguments</h3> <table summary="R argblock"> <tr valign="top"><td><code>graph</code></td> <td> <p>The input graph, can be directed or undirected.</p> </td></tr> <tr valign="top"><td><code>algorithm</code></td> <td> <p>The algorithm to use. Currently only <code>arpack</code> is implemented, which uses the ARPACK solver. See also <code><a href="arpack.html">arpack</a></code>.</p> </td></tr> <tr valign="top"><td><code>which</code></td> <td> <p>A list to specify which eigenvalues and eigenvectors to calculate. By default the leading (i.e. largest magnitude) eigenvalue and the corresponding eigenvector is calculated.</p> </td></tr> <tr valign="top"><td><code>options</code></td> <td> <p>Options for the ARPACK solver. See <code><a href="arpack.html">arpack_defaults</a></code>.</p> </td></tr> </table> <h3>Details</h3> <p>The <code>which</code> argument is a list and it specifies which eigenvalues and corresponding eigenvectors to calculate: There are eight options: </p> <ol> <li><p> Eigenvalues with the largest magnitude. Set <code>pos</code> to <code>LM</code>, and <code>howmany</code> to the number of eigenvalues you want. </p> </li> <li> <p>Eigenvalues with the smallest magnitude. Set <code>pos</code> to <code>SM</code> and <code>howmany</code> to the number of eigenvalues you want. </p> </li> <li><p> Largest eigenvalues. Set <code>pos</code> to <code>LA</code> and <code>howmany</code> to the number of eigenvalues you want. </p> </li> <li><p> Smallest eigenvalues. Set <code>pos</code> to <code>SA</code> and <code>howmany</code> to the number of eigenvalues you want. </p> </li> <li> <p>Eigenvalues from both ends of the spectrum. Set <code>pos</code> to <code>BE</code> and <code>howmany</code> to the number of eigenvalues you want. If <code>howmany</code> is odd, then one more eigenvalue is returned from the larger end. </p> </li> <li> <p>Selected eigenvalues. This is not (yet) implemented currently. </p> </li> <li> <p>Eigenvalues in an interval. This is not (yet) implemented. </p> </li> <li><p> All eigenvalues. This is not implemented yet. The standard <code>eigen</code> function does a better job at this, anyway. </p> </li></ol> <p>Note that ARPACK might be unstable for graphs with multiple components, e.g. graphs with isolate vertices. </p> <h3>Value</h3> <p>Depends on the algorithm used. </p> <p>For <code>arpack</code> a list with three entries is returned: </p> <table summary="R valueblock"> <tr valign="top"><td><code>options</code></td> <td> <p>See the return value for <code>arpack</code> for a complete description.</p> </td></tr> <tr valign="top"><td><code>values</code></td> <td> <p>Numeric vector, the eigenvalues.</p> </td></tr> <tr valign="top"><td><code>vectors</code></td> <td> <p>Numeric matrix, with the eigenvectors as columns.</p> </td></tr> </table> <h3>Author(s)</h3> <p>Gabor Csardi <a href="mailto:csardi.gabor@gmail.com">csardi.gabor@gmail.com</a> </p> <h3>See Also</h3> <p><code><a href="as_adjacency_matrix.html">as_adj</a></code> to create a (sparse) adjacency matrix. </p> <h3>Examples</h3> <pre> ## Small example graph, leading eigenvector by default kite <- make_graph("Krackhardt_kite") spectrum(kite)[c("values", "vectors")] ## Double check eigen(as_adj(kite, sparse=FALSE))$vectors[,1] ## Should be the same as 'eigen_centrality' (but rescaled) cor(eigen_centrality(kite)$vector, spectrum(kite)$vectors) ## Smallest eigenvalues spectrum(kite, which=list(pos="SM", howmany=2))$values </pre> <hr /><div style="text-align: center;">[Package <em>igraph</em> version 1.3.5 <a href="00Index.html">Index</a>]</div> </body></html>