EVOLUTION-MANAGER
Edit File: as.matrix.igraph.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: Convert igraph objects to adjacency or edge list 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 as.matrix.igraph {igraph}"><tr><td>as.matrix.igraph {igraph}</td><td style="text-align: right;">R Documentation</td></tr></table> <h2>Convert igraph objects to adjacency or edge list matrices</h2> <h3>Description</h3> <p>Get adjacency or edgelist representation of the network stored as an <code>igraph</code> object. </p> <h3>Usage</h3> <pre> ## S3 method for class 'igraph' as.matrix(x, matrix.type = c("adjacency", "edgelist"), ...) </pre> <h3>Arguments</h3> <table summary="R argblock"> <tr valign="top"><td><code>x</code></td> <td> <p>object of class igraph, the network</p> </td></tr> <tr valign="top"><td><code>matrix.type</code></td> <td> <p>character, type of matrix to return, currently "adjacency" or "edgelist" are supported</p> </td></tr> <tr valign="top"><td><code>...</code></td> <td> <p>other arguments to/from other methods</p> </td></tr> </table> <h3>Details</h3> <p>If <code>matrix.type</code> is <code>"edgelist"</code>, then a two-column numeric edge list matrix is returned. The value of <code>attrname</code> is ignored. </p> <p>If <code>matrix.type</code> is <code>"adjacency"</code>, then a square adjacency matrix is returned. For adjacency matrices, you can use the <code>attr</code> keyword argument to use the values of an edge attribute in the matrix cells. See the documentation of <a href="as_adjacency_matrix.html">as_adjacency_matrix</a> for more details. </p> <p>Other arguments passed through <code>...</code> are passed to either <code><a href="as_adjacency_matrix.html">as_adjacency_matrix</a></code> or <code><a href="as_edgelist.html">as_edgelist</a></code> depending on the value of <code>matrix.type</code>. </p> <h3>Value</h3> <p>Depending on the value of <code>matrix.type</code> either a square adjacency matrix or a two-column numeric matrix representing the edgelist. </p> <h3>Author(s)</h3> <p>Michal Bojanowski, originally from the <code>intergraph</code> package </p> <h3>See Also</h3> <p><code><a href="as_adjacency_matrix.html">as_adjacency_matrix</a></code>, <code><a href="as_edgelist.html">as_edgelist</a></code> </p> <h3>Examples</h3> <pre> g <- make_graph("zachary") as.matrix(g, "adjacency") as.matrix(g, "edgelist") # use edge attribute "weight" E(g)$weight <- rep(1:10, each=ecount(g)) as.matrix(g, "adjacency", sparse=FALSE, attr="weight") </pre> <hr /><div style="text-align: center;">[Package <em>igraph</em> version 1.3.5 <a href="00Index.html">Index</a>]</div> </body></html>