<?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>degreeVertex -- returns the degree of a vertex</title> <link rel="stylesheet" type="text/css" href="../../../../Macaulay2/Style/doc.css"/> </head> <body> <table class="buttons"> <tr> <td><div><a href="_delete__Edges.html">next</a> | <a href="_cycle.html">previous</a> | <a href="_delete__Edges.html">forward</a> | <a href="_cycle.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>degreeVertex -- returns the degree of a vertex</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 = degreeVertex(H,n)</tt><br/><tt>d = degreeVertex(H,V)</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> <li><span><tt>n</tt>, <span>an <a href="../../Macaulay2Doc/html/___Z__Z.html">integer</a></span>, the index of a vertex</span></li> <li><span><tt>V</tt>, <span>a <a href="../../Macaulay2Doc/html/___Ring__Element.html">ring element</a></span>, a vertex/variable of the HyperGraph</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 degree of vertex <tt>V</tt> (or vertex number <tt>n</tt>)</span></li> </ul> </div> </li> </ul> </div> <div class="single"><h2>Description</h2> <div><div>The degree of a vertex in a (hyper)graph is the number of edges that contain the vertex. In a graph, the degree is also the number of elements in the neighbor set of a vertex.</div> <table class="examples"><tr><td><pre>i1 : S = QQ[a,b,c,d,e];</pre> </td></tr> <tr><td><pre>i2 : k5 = completeGraph S o2 = Graph{edges => {{a, b}, {a, c}, {a, d}, {a, e}, {b, c}, {b, d}, {b, e}, {c, d}, {c, e}, {d, e}}} ring => S vertices => {a, b, c, d, e} o2 : Graph</pre> </td></tr> <tr><td><pre>i3 : dv = degreeVertex(k5,a) o3 = 4</pre> </td></tr> <tr><td><pre>i4 : n = neighbors(k5,a) o4 = {b, c, d, e} o4 : List</pre> </td></tr> <tr><td><pre>i5 : #n == dv o5 = true</pre> </td></tr> <tr><td><pre>i6 : degreeVertex(k5,2) o6 = 4</pre> </td></tr> <tr><td><pre>i7 : h = hyperGraph {a*b*c,c*d,a*d*e,b*e,c*e} o7 = HyperGraph{edges => {{a, b, c}, {c, d}, {b, e}, {c, e}, {a, d, e}}} ring => S vertices => {a, b, c, d, e} o7 : HyperGraph</pre> </td></tr> <tr><td><pre>i8 : degreeVertex(h,a) o8 = 2</pre> </td></tr> <tr><td><pre>i9 : degreeVertex(h,2) -- degree of c o9 = 3</pre> </td></tr> </table> </div> </div> <div class="single"><h2>See also</h2> <ul><li><span><a href="_neighbors.html" title="returns the neighbors of a vertex or list of vertices">neighbors</a> -- returns the neighbors of a vertex or list of vertices</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>degreeVertex</tt> :</h2> <ul><li>degreeVertex(HyperGraph,RingElement)</li> <li>degreeVertex(HyperGraph,ZZ)</li> </ul> </div> </div> </body> </html>