Sophie

Sophie

distrib > Fedora > 15 > i386 > by-pkgid > 7ebd25ac536d248d499a3ce2acda963a > files > 1860

Macaulay2-1.3.1-8.fc15.i686.rpm

<?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>numConnectedGraphComponents -- returns the number of connected components in a graph</title>
<link rel="stylesheet" type="text/css" href="../../../../Macaulay2/Style/doc.css"/>
</head>
<body>
<table class="buttons">
  <tr>
    <td><div><a href="_num__Triangles.html">next</a> | <a href="_num__Connected__Components.html">previous</a> | <a href="_num__Triangles.html">forward</a> | <a href="_num__Connected__Components.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>numConnectedGraphComponents -- returns the number of connected components in a graph</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>d = numConnectedGraphComponents G</tt></div>
</dd></dl>
</div>
</li>
<li><div class="single">Inputs:<ul><li><span><tt>G</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>d</tt>, <span>an <a href="../../Macaulay2Doc/html/___Z__Z.html">integer</a></span>, the number of connected components of G</span></li>
</ul>
</div>
</li>
</ul>
</div>
<div class="single"><h2>Description</h2>
<div><p>This function returns the number of connected components of a graph. A connected component of a graph is any maximal set of vertices which are pairwise connected by a path.  Isolated vertices, which are those not appearing in any edge, count as connected components. This is in contrast to <a href="_num__Connected__Components.html" title="returns the number of connected components in a (hyper)graph">numConnectedComponents</a> in which isolated vertices are not counted as connected components. See the <a href="___Connected_sp__Components_sp__Tutorial.html" title="clarifying the difference between graph and hypergraph components">Connected Components Tutorial</a> for more information.</p>
<p>The algorithm used by <tt>numConnectedGraphComponents</tt> turns <tt>G</tt> into a simplicial complex, and then computes the rank of the 0<sup>th</sup> reduced homology group. This number plus 1 plus the number of isolated vertices of <tt>G</tt> gives the number of connected components of <tt>G</tt>.</p>
<div>This method is intended to match the most common meaning for the number of connected components of a graph. This method can also be used on hypergraphs.</div>
<table class="examples"><tr><td><pre>i1 : S = QQ[a..e];</pre>
</td></tr>
<tr><td><pre>i2 : g = graph {a*b,b*c,c*d,d*e,a*e} -- the 5-cycle (connected)

o2 = Graph{edges => {{a, b}, {b, c}, {c, d}, {a, e}, {d, e}}}
           ring => S
           vertices => {a, b, c, d, e}

o2 : Graph</pre>
</td></tr>
<tr><td><pre>i3 : h = graph {a*b,b*c,c*a,d*e} -- a 3-cycle and a disjoint edge (not connected)

o3 = Graph{edges => {{a, b}, {a, c}, {b, c}, {d, e}}}
           ring => S
           vertices => {a, b, c, d, e}

o3 : Graph</pre>
</td></tr>
<tr><td><pre>i4 : k = graph {a*b,b*c,c*d,a*d} -- 4-cycle and isolated vertex (not connected)

o4 = Graph{edges => {{a, b}, {b, c}, {a, d}, {c, d}}}
           ring => S
           vertices => {a, b, c, d, e}

o4 : Graph</pre>
</td></tr>
<tr><td><pre>i5 : numConnectedGraphComponents g

o5 = 1</pre>
</td></tr>
<tr><td><pre>i6 : numConnectedGraphComponents h

o6 = 2</pre>
</td></tr>
<tr><td><pre>i7 : numConnectedGraphComponents k

o7 = 2</pre>
</td></tr>
</table>
</div>
</div>
<div class="single"><h2>See also</h2>
<ul><li><span><a href="___Connected_sp__Components_sp__Tutorial.html" title="clarifying the difference between graph and hypergraph components">Connected Components Tutorial</a> -- clarifying the difference between graph and hypergraph components</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__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>
</ul>
</div>
<div class="waystouse"><h2>Ways to use <tt>numConnectedGraphComponents</tt> :</h2>
<ul><li>numConnectedGraphComponents(HyperGraph)</li>
</ul>
</div>
</div>
</body>
</html>