Description Usage Arguments Details Value Author(s) See Also Examples
Calculate selected eigenvalues and eigenvectors of a (supposedly sparse) graph.
1 2 3 4 5 6 
graph 
The input graph, can be directed or undirected. 
algorithm 
The algorithm to use. Currently only 
which 
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. 
options 
Options for the ARPACK solver. See

The which
argument is a list and it specifies which eigenvalues and
corresponding eigenvectors to calculate: There are eight options:
Eigenvalues with the largest magnitude. Set pos
to
LM
, and howmany
to the number of eigenvalues you want.
Eigenvalues with the smallest magnitude. Set pos
to SM
and
howmany
to the number of eigenvalues you want.
Largest
eigenvalues. Set pos
to LA
and howmany
to the number of
eigenvalues you want.
Smallest eigenvalues. Set pos
to
SA
and howmany
to the number of eigenvalues you want.
Eigenvalues from both ends of the spectrum. Set pos
to BE
and
howmany
to the number of eigenvalues you want. If howmany
is
odd, then one more eigenvalue is returned from the larger end.
Selected eigenvalues. This is not (yet) implemented currently.
Eigenvalues in an interval. This is not (yet) implemented.
All
eigenvalues. This is not implemented yet. The standard eigen
function
does a better job at this, anyway.
Note that ARPACK might be unstable for graphs with multiple components, e.g. graphs with isolate vertices.
Depends on the algorithm used.
For arpack
a list with three entries is returned:
options 
See
the return value for 
values 
Numeric vector, the eigenvalues. 
vectors 
Numeric matrix, with the eigenvectors as columns. 
Gabor Csardi csardi.gabor@gmail.com
as_adj
to create a (sparse) adjacency matrix.
1 2 3 4 5 6 7 8 9 10 11 12  ## 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

Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.