EVOLUTION-MANAGER
Edit File: compose.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: Compose two graphs as binary relations</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 compose {igraph}"><tr><td>compose {igraph}</td><td style="text-align: right;">R Documentation</td></tr></table> <h2>Compose two graphs as binary relations</h2> <h3>Description</h3> <p>Relational composition of two graph. </p> <h3>Usage</h3> <pre> compose(g1, g2, byname = "auto") </pre> <h3>Arguments</h3> <table summary="R argblock"> <tr valign="top"><td><code>g1</code></td> <td> <p>The first input graph.</p> </td></tr> <tr valign="top"><td><code>g2</code></td> <td> <p>The second input graph.</p> </td></tr> <tr valign="top"><td><code>byname</code></td> <td> <p>A logical scalar, or the character scalar <code>auto</code>. Whether to perform the operation based on symbolic vertex names. If it is <code>auto</code>, that means <code>TRUE</code> if both graphs are named and <code>FALSE</code> otherwise. A warning is generated if <code>auto</code> and one graph, but not both graphs are named.</p> </td></tr> </table> <h3>Details</h3> <p><code>compose</code> creates the relational composition of two graphs. The new graph will contain an (a,b) edge only if there is a vertex c, such that edge (a,c) is included in the first graph and (c,b) is included in the second graph. The corresponding operator is %c%. </p> <p>The function gives an error if one of the input graphs is directed and the other is undirected. </p> <p>If the <code>byname</code> argument is <code>TRUE</code> (or <code>auto</code> and the graphs are all named), then the operation is performed based on symbolic vertex names. Otherwise numeric vertex ids are used. </p> <p><code>compose</code> keeps the attributes of both graphs. All graph, vertex and edge attributes are copied to the result. If an attribute is present in multiple graphs and would result a name clash, then this attribute is renamed by adding suffixes: _1, _2, etc. </p> <p>The <code>name</code> vertex attribute is treated specially if the operation is performed based on symbolic vertex names. In this case <code>name</code> must be present in both graphs, and it is not renamed in the result graph. </p> <p>Note that an edge in the result graph corresponds to two edges in the input, one in the first graph, one in the second. This mapping is not injective and several edges in the result might correspond to the same edge in the first (and/or the second) graph. The edge attributes in the result graph are updated accordingly. </p> <p>Also note that the function may generate multigraphs, if there are more than one way to find edges (a,b) in g1 and (b,c) in g2 for an edge (a,c) in the result. See <code><a href="simplify.html">simplify</a></code> if you want to get rid of the multiple edges. </p> <p>The function may create loop edges, if edges (a,b) and (b,a) are present in g1 and g2, respectively, then (a,a) is included in the result. See <code><a href="simplify.html">simplify</a></code> if you want to get rid of the self-loops. </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> g1 <- make_ring(10) g2 <- make_star(10, mode="undirected") gc <- compose(g1, g2) print_all(gc) print_all(simplify(gc)) </pre> <hr /><div style="text-align: center;">[Package <em>igraph</em> version 1.3.5 <a href="00Index.html">Index</a>]</div> </body></html>