Macaulay2 » Documentation
Packages » Graphs :: degree(Digraph,Thing)
next | previous | forward | backward | up | index | toc

degree(Digraph,Thing) -- returns the degree of a vertex in a digraph



In a simple graph, the degree of a vertex is the number of neighbors of the vertex. In a digraph, we define the degree of a vertex to be the number of elements in the unique union of the parents and children of the vertex.

i1 : D = digraph({1,2,3,4},{{1,2},{2,3},{3,4},{4,2},{2,4}});
i2 : degree(D, 3)

o2 = 2
i3 : degree(D, 2)

o3 = 3

See also

Ways to use this method: