<?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>Connected Components Tutorial -- clarifying the difference between graph and hypergraph components</title> <link rel="stylesheet" type="text/css" href="../../../../Macaulay2/Style/doc.css"/> </head> <body> <table class="buttons"> <tr> <td><div><a href="_connected__Components.html">next</a> | <a href="_complete__Multi__Partite.html">previous</a> | <a href="_connected__Components.html">forward</a> | <a href="_complete__Multi__Partite.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>Connected Components Tutorial -- clarifying the difference between graph and hypergraph components</h1> <div><p>In this tutorial, we discuss the various methods that deal with connected components of graphs and hypergraphs. Our main objective is to make a distinction between the two different definitions of connected components that are used in the <a href="index.html" title="A package for working with the edge ideals of (hyper)graphs">EdgeIdeals</a> package.</p> <p>A vertex of a (hyper)graph <tt>H</tt> said to be an isolated vertex if it is not contained in any edge of <tt>H</tt>. In particular, if a vertex of <tt>H</tt> is contained in a edge of size one then it is not considered isolated.</p> <div/> <table class="examples"><tr><td><pre>i1 : R = QQ[u,v,x,y,z];</pre> </td></tr> <tr><td><pre>i2 : H = hyperGraph({{u,v},{x}});</pre> </td></tr> <tr><td><pre>i3 : isolatedVertices H o3 = {y, z} o3 : List</pre> </td></tr> </table> <p><em>Graph Components</em>. A connected component of a graph is any maximal set of vertices which are pairwise connected by a (possibly trivial) path. The most important part of this definition is that isolated vertices count as connected components.</p> <p>The following methods use this definition of a connected component: <a href="_connected__Graph__Components.html" title="returns the connected components of a graph">connectedGraphComponents</a>, <a href="_num__Connected__Graph__Components.html" title="returns the number of connected components in a graph">numConnectedGraphComponents</a> and <a href="_is__Connected__Graph.html" title="determines if a graph is connected">isConnectedGraph</a>.</p> <p><em>Hypergraph Components</em>. A connected component of a hypergraph is any maximal set of vertices which are pairwise connected by a non-trivial path. Here isolated vertices do not count as connected components.</p> <p>The following methods use the hypergraph definition of a connected component: <a href="_connected__Components.html" title="returns the connected components of a hypergraph">connectedComponents</a>, <a href="_num__Connected__Components.html" title="returns the number of connected components in a (hyper)graph">numConnectedComponents</a> and <a href="_is__Connected.html" title="determines if a (hyper)graph is connected">isConnected</a>.</p> <p>The next example uses all of these methods on a graph to illustrate the difference between the two definitions.</p> <div/> <table class="examples"><tr><td><pre>i4 : R = QQ[u,v,x,y,z];</pre> </td></tr> <tr><td><pre>i5 : G = graph({{x,y},{y,z}});</pre> </td></tr> <tr><td><pre>i6 : isolatedVertices G o6 = {u, v} o6 : List</pre> </td></tr> <tr><td><pre>i7 : connectedGraphComponents G o7 = {{u}, {v}, {x, y, z}} o7 : List</pre> </td></tr> <tr><td><pre>i8 : numConnectedGraphComponents G o8 = 3</pre> </td></tr> <tr><td><pre>i9 : isConnectedGraph G o9 = false</pre> </td></tr> <tr><td><pre>i10 : connectedComponents G o10 = {{x, y, z}} o10 : List</pre> </td></tr> <tr><td><pre>i11 : numConnectedComponents G o11 = 1</pre> </td></tr> <tr><td><pre>i12 : isConnected G o12 = true</pre> </td></tr> </table> </div> <div class="single"><h2>See also</h2> <ul><li><span><a href="_connected__Components.html" title="returns the connected components of a hypergraph">connectedComponents</a> -- returns the connected components of a hypergraph</span></li> <li><span><a href="_connected__Graph__Components.html" title="returns the connected components of a graph">connectedGraphComponents</a> -- returns the connected components of a graph</span></li> <li><span><a href="_is__Connected.html" title="determines if a (hyper)graph is connected">isConnected</a> -- determines if a (hyper)graph is connected</span></li> <li><span><a href="_is__Connected__Graph.html" title="determines if a graph is connected">isConnectedGraph</a> -- determines if a graph is connected</span></li> <li><span><a href="_isolated__Vertices.html" title="returns all vertices not contained in any edge">isolatedVertices</a> -- returns all vertices not contained in any edge</span></li> <li><span><a href="_num__Connected__Components.html" title="returns the number of connected components in a (hyper)graph">numConnectedComponents</a> -- returns the number of connected components in a (hyper)graph</span></li> <li><span><a href="_num__Connected__Graph__Components.html" title="returns the number of connected components in a graph">numConnectedGraphComponents</a> -- returns the number of connected components in a graph</span></li> </ul> </div> </div> </body> </html>