Macaulay2 » Documentation
Packages » EdgeIdeals :: degreeVertex
next | previous | forward | backward | up | index | toc

degreeVertex -- returns the degree of a vertex

Synopsis

Description

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.

i1 : S = QQ[a,b,c,d,e];
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
i3 : dv = degreeVertex(k5,a)

o3 = 4
i4 : n = neighbors(k5,a)

o4 = {b, c, d, e}

o4 : List
i5 : #n == dv

o5 = true
i6 : degreeVertex(k5,2)

o6 = 4
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
i8 : degreeVertex(h,a)

o8 = 2
i9 : degreeVertex(h,2) -- degree of c

o9 = 3

See also

Ways to use degreeVertex:

For the programmer

The object degreeVertex is a method function.