<?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>isBipartite -- determines if a graph is bipartite</title> <link rel="stylesheet" type="text/css" href="../../../../Macaulay2/Style/doc.css"/> </head> <body> <table class="buttons"> <tr> <td><div><a href="_is__Chordal.html">next</a> | <a href="_induced__Hyper__Graph.html">previous</a> | <a href="_is__Chordal.html">forward</a> | <a href="_induced__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>isBipartite -- determines if a graph is bipartite</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>b = isBipartite G</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> </ul> </div> </li> <li><div class="single">Outputs:<ul><li><span><tt>b</tt>, <span>a <a href="../../Macaulay2Doc/html/___Boolean.html">Boolean value</a></span>, <tt>true</tt> if <tt>G</tt> is bipartite, <tt>false</tt> otherwise</span></li> </ul> </div> </li> </ul> </div> <div class="single"><h2>Description</h2> <div><div>The function <tt>isBipartite</tt> determines if a given graph is bipartite. A graph is said to be bipartite if the vertices can be partitioned into two sets W and Y such that every edge has one vertex in W and the other in Y. Since a graph is bipartite if and only if its chromatic number is 2, we can check if a graph is bipartite by computing its chromatic number.</div> <table class="examples"><tr><td><pre>i1 : S = QQ[a..e];</pre> </td></tr> <tr><td><pre>i2 : t = graph {a*b,b*c,c*d,a*e} -- a tree (and thus, bipartite) o2 = Graph{edges => {{a, b}, {b, c}, {c, d}, {a, e}}} ring => S vertices => {a, b, c, d, e} o2 : Graph</pre> </td></tr> <tr><td><pre>i3 : c5 = cycle S -- 5-cycle (not bipartite) o3 = Graph{edges => {{a, b}, {b, c}, {c, d}, {d, e}, {a, e}}} ring => S vertices => {a, b, c, d, e} o3 : Graph</pre> </td></tr> <tr><td><pre>i4 : isBipartite t o4 = true</pre> </td></tr> <tr><td><pre>i5 : isBipartite c5 o5 = false</pre> </td></tr> </table> </div> </div> <div class="single"><h2>See also</h2> <ul><li><span><a href="_chromatic__Number.html" title="computes the chromatic number of a hypergraph">chromaticNumber</a> -- computes the chromatic number of a hypergraph</span></li> </ul> </div> <div class="waystouse"><h2>Ways to use <tt>isBipartite</tt> :</h2> <ul><li>isBipartite(Graph)</li> </ul> </div> </div> </body> </html>