EVOLUTION-MANAGER
Edit File: contract.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: Contract several vertices into a single one</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 contract {igraph}"><tr><td>contract {igraph}</td><td style="text-align: right;">R Documentation</td></tr></table> <h2>Contract several vertices into a single one</h2> <h3>Description</h3> <p>This function creates a new graph, by merging several vertices into one. The vertices in the new graph correspond to sets of vertices in the input graph. </p> <h3>Usage</h3> <pre> contract(graph, mapping, vertex.attr.comb = igraph_opt("vertex.attr.comb")) </pre> <h3>Arguments</h3> <table summary="R argblock"> <tr valign="top"><td><code>graph</code></td> <td> <p>The input graph, it can be directed or undirected.</p> </td></tr> <tr valign="top"><td><code>mapping</code></td> <td> <p>A numeric vector that specifies the mapping. Its elements correspond to the vertices, and for each element the id in the new graph is given.</p> </td></tr> <tr valign="top"><td><code>vertex.attr.comb</code></td> <td> <p>Specifies how to combine the vertex attributes in the new graph. Please see <code><a href="igraph-attribute-combination.html">attribute.combination</a></code> for details.</p> </td></tr> </table> <h3>Details</h3> <p>The attributes of the graph are kept. Graph and edge attributes are unchanged, vertex attributes are combined, according to the <code>vertex.attr.comb</code> parameter. </p> <h3>Value</h3> <p>A new graph object. </p> <h3>Author(s)</h3> <p>Gabor Csardi <a href="mailto:csardi.gabor@gmail.com">csardi.gabor@gmail.com</a> </p> <h3>Examples</h3> <pre> g <- make_ring(10) g$name <- "Ring" V(g)$name <- letters[1:vcount(g)] E(g)$weight <- runif(ecount(g)) g2 <- contract(g, rep(1:5, each=2), vertex.attr.comb=toString) ## graph and edge attributes are kept, vertex attributes are ## combined using the 'toString' function. print(g2, g=TRUE, v=TRUE, e=TRUE) </pre> <hr /><div style="text-align: center;">[Package <em>igraph</em> version 1.3.5 <a href="00Index.html">Index</a>]</div> </body></html>