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
neighbors -- returns the neighbors of a vertex in a graph
parents -- returns the parents of a vertex on a digraph
children -- returns the children of a vertex of a digraph