EVOLUTION-MANAGER
Edit File: graph_from_graphnel.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 graphNEL objects from the graph package to igraph</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 graph_from_graphnel {igraph}"><tr><td>graph_from_graphnel {igraph}</td><td style="text-align: right;">R Documentation</td></tr></table> <h2>Convert graphNEL objects from the graph package to igraph</h2> <h3>Description</h3> <p>The graphNEL class is defined in the <code>graph</code> package, it is another way to represent graphs. <code>graph_from_graphnel</code> takes a graphNEL graph and converts it to an igraph graph. It handles all graph/vertex/edge attributes. If the graphNEL graph has a vertex attribute called ‘<code>name</code>’ it will be used as igraph vertex attribute ‘<code>name</code>’ and the graphNEL vertex names will be ignored. </p> <h3>Usage</h3> <pre> graph_from_graphnel(graphNEL, name = TRUE, weight = TRUE, unlist.attrs = TRUE) </pre> <h3>Arguments</h3> <table summary="R argblock"> <tr valign="top"><td><code>graphNEL</code></td> <td> <p>The graphNEL graph.</p> </td></tr> <tr valign="top"><td><code>name</code></td> <td> <p>Logical scalar, whether to add graphNEL vertex names as an igraph vertex attribute called ‘<code>name</code>’.</p> </td></tr> <tr valign="top"><td><code>weight</code></td> <td> <p>Logical scalar, whether to add graphNEL edge weights as an igraph edge attribute called ‘<code>weight</code>’. (graphNEL graphs are always weighted.)</p> </td></tr> <tr valign="top"><td><code>unlist.attrs</code></td> <td> <p>Logical scalar. graphNEL attribute query functions return the values of the attributes in R lists, if this argument is <code>TRUE</code> (the default) these will be converted to atomic vectors, whenever possible, before adding them to the igraph graph.</p> </td></tr> </table> <h3>Details</h3> <p>Because graphNEL graphs poorly support multiple edges, the edge attributes of the multiple edges are lost: they are all replaced by the attributes of the first of the multiple edges. </p> <h3>Value</h3> <p><code>graph_from_graphnel</code> returns an igraph graph object. </p> <h3>See Also</h3> <p><code><a href="as_graphnel.html">as_graphnel</a></code> for the other direction, <code><a href="as_adjacency_matrix.html">as_adj</a></code>, <code><a href="graph_from_adjacency_matrix.html">graph_from_adjacency_matrix</a></code>, <code><a href="as_adj_list.html">as_adj_list</a></code> and <code><a href="graph_from_adj_list.html">graph.adjlist</a></code> for other graph representations. </p> <h3>Examples</h3> <pre> ## Not run: ## Undirected g <- make_ring(10) V(g)$name <- letters[1:10] GNEL <- as_graphnel(g) g2 <- graph_from_graphnel(GNEL) g2 ## Directed g3 <- make_star(10, mode="in") V(g3)$name <- letters[1:10] GNEL2 <- as_graphnel(g3) g4 <- graph_from_graphnel(GNEL2) g4 ## End(Not run) </pre> <hr /><div style="text-align: center;">[Package <em>igraph</em> version 1.3.5 <a href="00Index.html">Index</a>]</div> </body></html>