In a graph, the degree of node v is the total number of edges that contain v. For example in the graph below, the node B has degree three.
The indegree of a node v is the number of directed edges that point towards v. So, in the graph, the indegree of node C is two. Similarly, the outdegree of a node v is the number of directed edges that point away from v. Thus the outdegree of node C in the graph is one.
A leaf in a graph is a node with indegree one and outdegree zero, or in the undirected case, degree one.
In other languages