<?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>connectedGraphComponents -- returns the connected components of a graph</title> <link rel="stylesheet" type="text/css" href="../../../../Macaulay2/Style/doc.css"/> </head> <body> <table class="buttons"> <tr> <td><div><a href="___Constructor_sp__Overview.html">next</a> | <a href="_connected__Components.html">previous</a> | <a href="___Constructor_sp__Overview.html">forward</a> | <a href="_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>connectedGraphComponents -- returns the connected components of 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>L = connectedGraphComponents 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>L</tt>, <span>a <a href="../../Macaulay2Doc/html/___List.html">list</a></span>, of lists of vertices. Each list of vertices is a connected component of G.</span></li> </ul> </div> </li> </ul> </div> <div class="single"><h2>Description</h2> <div><p>This function returns the connected components of a graph. A connected component of a graph is any maximal set of vertices which are pairwise connected by a (possibly trivial) path. Isolated vertices, which are those not appearing in any edge, form their own connected components. This is in contrast to <a href="_connected__Components.html" title="returns the connected components of a hypergraph">connectedComponents</a> in which isolated vertices do not appear in any 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> <div/> <table class="examples"><tr><td><pre>i1 : R = QQ[a..k];</pre> </td></tr> <tr><td><pre>i2 : G = graph {a*b,b*c,c*d,a*d,f*g,h*i,j*k,h*k} o2 = Graph{edges => {{a, b}, {b, c}, {a, d}, {c, d}, {f, g}, {h, i}, {h, k}, {j, k}}} ring => R vertices => {a, b, c, d, e, f, g, h, i, j, k} o2 : Graph</pre> </td></tr> <tr><td><pre>i3 : L = connectedGraphComponents G o3 = {{e}, {a, b, c, d}, {f, g}, {h, i, j, k}} o3 : List</pre> </td></tr> </table> <p>In the following example, graph <tt>G</tt> contains the isolated vertex <tt>d</tt>. Notice that <tt>d</tt> appears in its own connected component and hence <tt>G</tt> is not connected.</p> <div/> <table class="examples"><tr><td><pre>i4 : R = QQ[a,b,c,d];</pre> </td></tr> <tr><td><pre>i5 : G = graph {a*b, b*c} o5 = Graph{edges => {{a, b}, {b, c}}} ring => R vertices => {a, b, c, d} o5 : Graph</pre> </td></tr> <tr><td><pre>i6 : connectedGraphComponents G o6 = {{d}, {a, b, c}} o6 : List</pre> </td></tr> <tr><td><pre>i7 : isolatedVertices G o7 = {d} o7 : List</pre> </td></tr> <tr><td><pre>i8 : isConnectedGraph G o8 = false</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__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="_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="_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> <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> </ul> </div> <div class="waystouse"><h2>Ways to use <tt>connectedGraphComponents</tt> :</h2> <ul><li>connectedGraphComponents(HyperGraph)</li> </ul> </div> </div> </body> </html>