<?xml version="1.0" encoding="utf-8" ?> <!-- for emacs: -*- coding: utf-8 -*- --> <!-- Apache may like this line in the file .htaccess: AddCharset utf-8 .html --> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1 plus MathML 2.0 plus SVG 1.1//EN" "http://www.w3.org/2002/04/xhtml-math-svg/xhtml-math-svg-flat.dtd" > <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"> <head><title>complementGraph -- returns the complement of a graph or hypergraph</title> <link rel="stylesheet" type="text/css" href="../../../../Macaulay2/Style/doc.css"/> </head> <body> <table class="buttons"> <tr> <td><div><a href="_complete__Graph.html">next</a> | <a href="_clique__Number.html">previous</a> | <a href="_complete__Graph.html">forward</a> | <a href="_clique__Number.html">backward</a> | up | <a href="index.html">top</a> | <a href="master.html">index</a> | <a href="toc.html">toc</a> | <a href="http://www.math.uiuc.edu/Macaulay2/">Macaulay2 web site</a></div> </td> </tr> </table> <hr/> <div><h1>complementGraph -- returns the complement of a graph or hypergraph</h1> <div class="single"><h2>Synopsis</h2> <ul><li><div class="list"><dl class="element"><dt class="heading">Usage: </dt><dd class="value"><div><tt>g = complementGraph G</tt><br/><tt>h = complementGraph H</tt></div> </dd></dl> </div> </li> <li><div class="single">Inputs:<ul><li><span><tt>G</tt>, <span>a <a href="___Graph.html">graph</a></span></span></li> <li><span><tt>H</tt>, <span>a <a href="___Hyper__Graph.html">hypergraph</a></span></span></li> </ul> </div> </li> <li><div class="single">Outputs:<ul><li><span><tt>g</tt>, <span>a <a href="___Graph.html">graph</a></span>, the complement of G, whose edges are the set of edges not in G</span></li> <li><span><tt>h</tt>, <span>a <a href="___Hyper__Graph.html">hypergraph</a></span>, the complement of H, whose edge set is found by taking the complement of each edge of H in the vertex set</span></li> </ul> </div> </li> </ul> </div> <div class="single"><h2>Description</h2> <div><div>The function <tt>complementGraph</tt> finds the complement of a graph and hypergraph. Note that this function behaves differently depending upon the type of input. When applied to a graph, complementGraph returns the graph whose edge set is the set of edges not in G. When applied to a hypergraph, the edge set is found by taking the complement of each edge of H in the vertex set.</div> <table class="examples"><tr><td><pre>i1 : R = QQ[a,b,c,d,e];</pre> </td></tr> <tr><td><pre>i2 : c5 = graph {a*b,b*c,c*d,d*e,e*a}; -- graph of the 5-cycle</pre> </td></tr> <tr><td><pre>i3 : complementGraph c5 -- the graph complement of the 5-cycle o3 = Graph{edges => {{b, d}, {a, d}, {c, e}, {b, e}, {a, c}}} ring => R vertices => {a, b, c, d, e} o3 : Graph</pre> </td></tr> <tr><td><pre>i4 : c5hypergraph = hyperGraph c5 -- the 5-cycle, but viewed as a hypergraph o4 = HyperGraph{edges => {{a, b}, {b, c}, {c, d}, {a, e}, {d, e}}} ring => R vertices => {a, b, c, d, e} o4 : HyperGraph</pre> </td></tr> <tr><td><pre>i5 : complementGraph c5hypergraph o5 = HyperGraph{edges => {{c, d, e}, {a, d, e}, {b, a, e}, {c, b, d}, {c, b, a}}} ring => R vertices => {a, b, c, d, e} o5 : HyperGraph</pre> </td></tr> </table> </div> </div> <div class="single"><h2>Caveat</h2> <div><div>Notice that <tt>complementGraph</tt> works differently on graphs versus hypergraphs.</div> </div> </div> <div class="waystouse"><h2>Ways to use <tt>complementGraph</tt> :</h2> <ul><li>complementGraph(Graph)</li> <li>complementGraph(HyperGraph)</li> </ul> </div> </div> </body> </html>