EVOLUTION-MANAGER
Edit File: cluster_leading_eigen.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: Community structure detecting based on the leading...</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 cluster_leading_eigen {igraph}"><tr><td>cluster_leading_eigen {igraph}</td><td style="text-align: right;">R Documentation</td></tr></table> <h2>Community structure detecting based on the leading eigenvector of the community matrix</h2> <h3>Description</h3> <p>This function tries to find densely connected subgraphs in a graph by calculating the leading non-negative eigenvector of the modularity matrix of the graph. </p> <h3>Usage</h3> <pre> cluster_leading_eigen( graph, steps = -1, weights = NULL, start = NULL, options = arpack_defaults, callback = NULL, extra = NULL, env = parent.frame() ) </pre> <h3>Arguments</h3> <table summary="R argblock"> <tr valign="top"><td><code>graph</code></td> <td> <p>The input graph. Should be undirected as the method needs a symmetric matrix.</p> </td></tr> <tr valign="top"><td><code>steps</code></td> <td> <p>The number of steps to take, this is actually the number of tries to make a step. It is not a particularly useful parameter.</p> </td></tr> <tr valign="top"><td><code>weights</code></td> <td> <p>The weights of the edges. It must be a positive numeric vector, <code>NULL</code> or <code>NA</code>. If it is <code>NULL</code> and the input graph has a ‘weight’ edge attribute, then that attribute will be used. If <code>NULL</code> and no such attribute is present, then the edges will have equal weights. Set this to <code>NA</code> if the graph was a ‘weight’ edge attribute, but you don't want to use it for community detection. A larger edge weight means a stronger connection for this function.</p> </td></tr> <tr valign="top"><td><code>start</code></td> <td> <p><code>NULL</code>, or a numeric membership vector, giving the start configuration of the algorithm.</p> </td></tr> <tr valign="top"><td><code>options</code></td> <td> <p>A named list to override some ARPACK options.</p> </td></tr> <tr valign="top"><td><code>callback</code></td> <td> <p>If not <code>NULL</code>, then it must be callback function. This is called after each iteration, after calculating the leading eigenvector of the modularity matrix. See details below.</p> </td></tr> <tr valign="top"><td><code>extra</code></td> <td> <p>Additional argument to supply to the callback function.</p> </td></tr> <tr valign="top"><td><code>env</code></td> <td> <p>The environment in which the callback function is evaluated.</p> </td></tr> </table> <h3>Details</h3> <p>The function documented in these section implements the ‘leading eigenvector’ method developed by Mark Newman, see the reference below. </p> <p>The heart of the method is the definition of the modularity matrix, <code>B</code>, which is <code>B=A-P</code>, <code>A</code> being the adjacency matrix of the (undirected) network, and <code>P</code> contains the probability that certain edges are present according to the ‘configuration model’. In other words, a <code>P[i,j]</code> element of <code>P</code> is the probability that there is an edge between vertices <code>i</code> and <code>j</code> in a random network in which the degrees of all vertices are the same as in the input graph. </p> <p>The leading eigenvector method works by calculating the eigenvector of the modularity matrix for the largest positive eigenvalue and then separating vertices into two community based on the sign of the corresponding element in the eigenvector. If all elements in the eigenvector are of the same sign that means that the network has no underlying comuunity structure. Check Newman's paper to understand why this is a good method for detecting community structure. </p> <h3>Value</h3> <p><code>cluster_leading_eigen</code> returns a named list with the following members: </p> <table summary="R valueblock"> <tr valign="top"><td><code>membership</code></td> <td> <p>The membership vector at the end of the algorithm, when no more splits are possible.</p> </td></tr> <tr valign="top"><td><code>merges</code></td> <td> <p>The merges matrix starting from the state described by the <code>membership</code> member. This is a two-column matrix and each line describes a merge of two communities, the first line is the first merge and it creates community ‘<code>N</code>’, <code>N</code> is the number of initial communities in the graph, the second line creates community <code>N+1</code>, etc. </p> </td></tr> <tr valign="top"><td><code>options</code></td> <td> <p>Information about the underlying ARPACK computation, see <code><a href="arpack.html">arpack</a></code> for details. </p> </td></tr> </table> <h3>Callback functions</h3> <p>The <code>callback</code> argument can be used to supply a function that is called after each eigenvector calculation. The following arguments are supplied to this function: </p> <dl> <dt>membership</dt><dd><p>The actual membership vector, with zero-based indexing.</p> </dd> <dt>community</dt><dd><p>The community that the algorithm just tried to split, community numbering starts with zero here.</p> </dd> <dt>value</dt><dd><p>The eigenvalue belonging to the leading eigenvector the algorithm just found.</p> </dd> <dt>vector</dt><dd><p>The leading eigenvector the algorithm just found.</p> </dd> <dt>multiplier</dt><dd><p>An R function that can be used to multiple the actual modularity matrix with an arbitrary vector. Supply the vector as an argument to perform this multiplication. This function can be used with ARPACK.</p> </dd> <dt>extra</dt><dd><p>The <code>extra</code> argument that was passed to <code>cluster_leading_eigen</code>. </p> </dd> </dl> <p>The callback function should return a scalar number. If this number is non-zero, then the clustering is terminated. </p> <h3>Author(s)</h3> <p>Gabor Csardi <a href="mailto:csardi.gabor@gmail.com">csardi.gabor@gmail.com</a> </p> <h3>References</h3> <p>MEJ Newman: Finding community structure using the eigenvectors of matrices, Physical Review E 74 036104, 2006. </p> <h3>See Also</h3> <p><code><a href="modularity.igraph.html">modularity</a></code>, <code><a href="cluster_walktrap.html">cluster_walktrap</a></code>, <code><a href="cluster_edge_betweenness.html">cluster_edge_betweenness</a></code>, <code><a href="cluster_fast_greedy.html">cluster_fast_greedy</a></code>, <code><a href="../../stats/html/as.dendrogram.html">as.dendrogram</a></code> </p> <h3>Examples</h3> <pre> g <- make_full_graph(5) %du% make_full_graph(5) %du% make_full_graph(5) g <- add_edges(g, c(1,6, 1,11, 6, 11)) lec <- cluster_leading_eigen(g) lec cluster_leading_eigen(g, start=membership(lec)) </pre> <hr /><div style="text-align: center;">[Package <em>igraph</em> version 1.3.5 <a href="00Index.html">Index</a>]</div> </body></html>