<?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>incidenceMatrix -- returns the incidence matrix of a hypergraph</title> <link rel="stylesheet" type="text/css" href="../../../../Macaulay2/Style/doc.css"/> </head> <body> <table class="buttons"> <tr> <td><div><a href="_independence__Complex.html">next</a> | <a href="_hyper__Graph__To__Simplicial__Complex.html">previous</a> | <a href="_independence__Complex.html">forward</a> | <a href="_hyper__Graph__To__Simplicial__Complex.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>incidenceMatrix -- returns the incidence matrix of a 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>M = incidenceMatrix H</tt></div> </dd></dl> </div> </li> <li><div class="single">Inputs:<ul><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>M</tt>, <span>a <a href="../../Macaulay2Doc/html/___Matrix.html">matrix</a></span>, the incidence matrix of the hypergraph</span></li> </ul> </div> </li> </ul> </div> <div class="single"><h2>Description</h2> <div><div>This function returns the incidence matrix of the given hypergraph <tt>H</tt>. The rows of the matrix are indexed by the variables of the hypergraph, and the columns are indexed by the edges. The (i,j)<sup>th</sup> entry in the matrix is 1 if vertex i is contained in edge j, and is 0 otherwise. The order of the rows and columns are determined by the internal order of the vertices and edges. See <a href="_edges.html" title="gets the edges of a (hyper)graph">edges</a> and <a href="_vertices.html" title="gets the vertices of a (hyper)graph">vertices</a>.</div> <table class="examples"><tr><td><pre>i1 : S = QQ[a..f];</pre> </td></tr> <tr><td><pre>i2 : g = hyperGraph {a*b*c*d,c*e,e*f} o2 = HyperGraph{edges => {{a, b, c, d}, {c, e}, {e, f}}} ring => S vertices => {a, b, c, d, e, f} o2 : HyperGraph</pre> </td></tr> <tr><td><pre>i3 : incidenceMatrix g o3 = | 1 0 0 | | 1 0 0 | | 1 1 0 | | 1 0 0 | | 0 1 1 | | 0 0 1 | 6 3 o3 : Matrix ZZ <--- ZZ</pre> </td></tr> <tr><td><pre>i4 : T = QQ[f,e,d,c,b,a];</pre> </td></tr> <tr><td><pre>i5 : h = hyperGraph {a*b*c*d,c*e,e*f} o5 = HyperGraph{edges => {{f, e}, {e, c}, {d, c, b, a}}} ring => T vertices => {f, e, d, c, b, a} o5 : HyperGraph</pre> </td></tr> <tr><td><pre>i6 : incidenceMatrix h -- although the same graph, matrix is different since variables have different ordering o6 = | 1 0 0 | | 1 1 0 | | 0 0 1 | | 0 1 1 | | 0 0 1 | | 0 0 1 | 6 3 o6 : Matrix ZZ <--- ZZ</pre> </td></tr> </table> </div> </div> <div class="single"><h2>See also</h2> <ul><li><span><a href="_adjacency__Matrix.html" title="returns the adjacency Matrix of a graph">adjacencyMatrix</a> -- returns the adjacency Matrix of a graph</span></li> <li><span><a href="_edges.html" title="gets the edges of a (hyper)graph">edges</a> -- gets the edges of a (hyper)graph</span></li> <li><span><a href="_vertices.html" title="gets the vertices of a (hyper)graph">vertices</a> -- gets the vertices of a (hyper)graph</span></li> </ul> </div> <div class="waystouse"><h2>Ways to use <tt>incidenceMatrix</tt> :</h2> <ul><li>incidenceMatrix(HyperGraph)</li> </ul> </div> </div> </body> </html>