<?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>hyperGraph -- constructor for HyperGraph</title> <link rel="stylesheet" type="text/css" href="../../../../Macaulay2/Style/doc.css"/> </head> <body> <table class="buttons"> <tr> <td><div><a href="___Hyper__Graph_sp_eq_eq_sp__Hyper__Graph.html">next</a> | <a href="___Hyper__Graph.html">previous</a> | <a href="___Hyper__Graph_sp_eq_eq_sp__Hyper__Graph.html">forward</a> | <a href="___Hyper__Graph.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>hyperGraph -- constructor for 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>H = hyperGraph(R,E)</tt><br/><tt>H = hyperGraph(I)</tt><br/><tt>H = hyperGraph(J)</tt><br/><tt>H = hyperGraph(E)</tt><br/><tt>H = hyperGraph(G)</tt></div> </dd></dl> </div> </li> <li><div class="single">Inputs:<ul><li><span><tt>R</tt>, <span>a <a href="../../Macaulay2Doc/html/___Polynomial__Ring.html">polynomial ring</a></span>, whose variables correspond to vertices of the hypergraph</span></li> <li><span><tt>E</tt>, <span>a <a href="../../Macaulay2Doc/html/___List.html">list</a></span>, a list of edges, which themselves are lists of vertices</span></li> <li><span><tt>I</tt>, <span>a <a href="../../Macaulay2Doc/html/___Monomial__Ideal.html">monomial ideal</a></span>, which must be square-free and whose generators become the edges of the hypergraph</span></li> <li><span><tt>J</tt>, <span>an <a href="../../Macaulay2Doc/html/___Ideal.html">ideal</a></span>, which must be square-free monomial and whose generators become the edges of the hypergraph</span></li> <li><span><tt>G</tt>, <span>a <a href="___Graph.html">graph</a></span>, which is to be converted to a HyperGraph</span></li> </ul> </div> </li> <li><div class="single">Outputs:<ul><li><span><tt>H</tt>, <span>a <a href="___Hyper__Graph.html">hypergraph</a></span></span></li> </ul> </div> </li> </ul> </div> <div class="single"><h2>Description</h2> <div><p>The function <tt>hyperGraph</tt> is a constructor for <a href="___Hyper__Graph.html" title="a class for hypergraphs">HyperGraph</a>. The user can input a hypergraph in a number of different ways, which we describe below. The information decribing the hypergraph is stored in a hash table. We require that there be no inclusion relations between the edges of a hypergraph; that is, that it be a clutter. The reason is that this package is designed for edge ideals, which would lose any information about edges that are supersets of other edges.</p> <div>For the first possiblity, the user inputs a polynomial ring, which specifices the vertices of graph, and a list of the edges of the graph. The edges are represented as lists.</div> <table class="examples"><tr><td><pre>i1 : R = QQ[a..f] o1 = R o1 : PolynomialRing</pre> </td></tr> <tr><td><pre>i2 : E = {{a,b,c},{b,c,d},{c,d,e},{e,d,f}} o2 = {{a, b, c}, {b, c, d}, {c, d, e}, {e, d, f}} o2 : List</pre> </td></tr> <tr><td><pre>i3 : h = hyperGraph (R,E) o3 = HyperGraph{edges => {{a, b, c}, {b, c, d}, {c, d, e}, {e, d, f}}} ring => R vertices => {a, b, c, d, e, f} o3 : HyperGraph</pre> </td></tr> </table> <div>Alternatively, if the polynomial ring has already been defined, it suffices simply to enter the list of the edges.</div> <table class="examples"><tr><td><pre>i4 : S = QQ[z_1..z_8] o4 = S o4 : PolynomialRing</pre> </td></tr> <tr><td><pre>i5 : E1 = {{z_1,z_2,z_3},{z_2,z_4,z_5,z_6},{z_4,z_7,z_8},{z_5,z_7,z_8}} o5 = {{z , z , z }, {z , z , z , z }, {z , z , z }, {z , z , z }} 1 2 3 2 4 5 6 4 7 8 5 7 8 o5 : List</pre> </td></tr> <tr><td><pre>i6 : E2 = {{z_2,z_3,z_4},{z_4,z_5}} o6 = {{z , z , z }, {z , z }} 2 3 4 4 5 o6 : List</pre> </td></tr> <tr><td><pre>i7 : h1 = hyperGraph E1 o7 = HyperGraph{edges => {{z , z , z }, {z , z , z , z }, {z , z , z }, {z , z , z }}} 1 2 3 2 4 5 6 4 7 8 5 7 8 ring => S vertices => {z , z , z , z , z , z , z , z } 1 2 3 4 5 6 7 8 o7 : HyperGraph</pre> </td></tr> <tr><td><pre>i8 : h2 = hyperGraph E2 o8 = HyperGraph{edges => {{z , z , z }, {z , z }} } 2 3 4 4 5 ring => S vertices => {z , z , z , z , z , z , z , z } 1 2 3 4 5 6 7 8 o8 : HyperGraph</pre> </td></tr> </table> <div>The list of edges could also be entered as a list of square-free monomials.</div> <table class="examples"><tr><td><pre>i9 : T = QQ[w,x,y,z] o9 = T o9 : PolynomialRing</pre> </td></tr> <tr><td><pre>i10 : e = {w*x*y,w*x*z,w*y*z,x*y*z} o10 = {w*x*y, w*x*z, w*y*z, x*y*z} o10 : List</pre> </td></tr> <tr><td><pre>i11 : h = hyperGraph e o11 = HyperGraph{edges => {{w, x, y}, {w, x, z}, {w, y, z}, {x, y, z}}} ring => T vertices => {w, x, y, z} o11 : HyperGraph</pre> </td></tr> </table> <div>Another option for defining an hypergraph is to use an <a href="../../Macaulay2Doc/html/_ideal.html" title="make an ideal">ideal</a> or <a href="../../Macaulay2Doc/html/_monomial__Ideal.html" title="make a monomial ideal">monomialIdeal</a>.</div> <table class="examples"><tr><td><pre>i12 : C = QQ[p_1..p_6] o12 = C o12 : PolynomialRing</pre> </td></tr> <tr><td><pre>i13 : i = monomialIdeal (p_1*p_2*p_3,p_3*p_4*p_5,p_3*p_6) o13 = monomialIdeal (p p p , p p p , p p ) 1 2 3 3 4 5 3 6 o13 : MonomialIdeal of C</pre> </td></tr> <tr><td><pre>i14 : hyperGraph i o14 = HyperGraph{edges => {{p , p , p }, {p , p , p }, {p , p }}} 1 2 3 3 4 5 3 6 ring => C vertices => {p , p , p , p , p , p } 1 2 3 4 5 6 o14 : HyperGraph</pre> </td></tr> <tr><td><pre>i15 : j = ideal (p_1*p_2,p_3*p_4*p_5,p_6) o15 = ideal (p p , p p p , p ) 1 2 3 4 5 6 o15 : Ideal of C</pre> </td></tr> <tr><td><pre>i16 : hyperGraph j o16 = HyperGraph{edges => {{p , p }, {p , p , p }, {p }}} 1 2 3 4 5 6 ring => C vertices => {p , p , p , p , p , p } 1 2 3 4 5 6 o16 : HyperGraph</pre> </td></tr> </table> <div>From any graph we can make a hypergraph with the same edges.</div> <table class="examples"><tr><td><pre>i17 : D = QQ[r_1..r_5] o17 = D o17 : PolynomialRing</pre> </td></tr> <tr><td><pre>i18 : g = graph {r_1*r_2,r_2*r_4,r_3*r_5,r_5*r_4,r_1*r_5} o18 = Graph{edges => {{r , r }, {r , r }, {r , r }, {r , r }, {r , r }}} 1 2 2 4 1 5 3 5 4 5 ring => D vertices => {r , r , r , r , r } 1 2 3 4 5 o18 : Graph</pre> </td></tr> <tr><td><pre>i19 : h = hyperGraph g o19 = HyperGraph{edges => {{r , r }, {r , r }, {r , r }, {r , r }, {r , r }}} 1 2 2 4 1 5 3 5 4 5 ring => D vertices => {r , r , r , r , r } 1 2 3 4 5 o19 : HyperGraph</pre> </td></tr> </table> <div>Not all hypergraph constructors are able to make the empty hypergraph, that is, the hypergraph with no edges. Specifically, the constructors that take only a list cannot make the empty hypergraph because the underlying ring is not given. To define the empty hypergraph, give an explicit polynomial ring or give the (monomial) ideal.</div> <table class="examples"><tr><td><pre>i20 : E = QQ[m,n,o,p] o20 = E o20 : PolynomialRing</pre> </td></tr> <tr><td><pre>i21 : hyperGraph(E, {}) o21 = HyperGraph{edges => {} } ring => E vertices => {m, n, o, p} o21 : HyperGraph</pre> </td></tr> <tr><td><pre>i22 : hyperGraph monomialIdeal(0_E) -- the zero element of E (do not use 0) o22 = HyperGraph{edges => {} } ring => E vertices => {m, n, o, p} o22 : HyperGraph</pre> </td></tr> <tr><td><pre>i23 : hyperGraph ideal (0_E) o23 = HyperGraph{edges => {} } ring => E vertices => {m, n, o, p} o23 : HyperGraph</pre> </td></tr> </table> </div> </div> <div class="single"><h2>See also</h2> <ul><li><span><a href="_graph.html" title="constructor for Graph">graph</a> -- constructor for Graph</span></li> <li><span><a href="___Constructor_sp__Overview.html" title="a summary of the many ways of making graphs and hypergraphs">Constructor Overview</a> -- a summary of the many ways of making graphs and hypergraphs</span></li> </ul> </div> <div class="waystouse"><h2>Ways to use <tt>hyperGraph</tt> :</h2> <ul><li>hyperGraph(Graph)</li> <li>hyperGraph(Ideal)</li> <li>hyperGraph(List)</li> <li>hyperGraph(MonomialIdeal)</li> <li>hyperGraph(PolynomialRing,List)</li> </ul> </div> </div> </body> </html>