Degree of each vertex in the graph

Degree(vertex) = The number of edges incident to the vertex(node).

In other words, the number of relations a particular node makes with the other nodes in the graph.

Example

Digraph



In-degree

In-degree of a vertex is the number of edges coming to the vertex.


In-degree of vertex 0 = 0

In-degree of vertex 1 = 1

In-degree of vertex 2 = 1

In-degree of vertex 3 = 3

In-degree of vertex 4 = 2




Out-degree

Out-degree of a vertex is the number edges which are coming out from the vertex.


Out-degree of vertex 0 = 3

Out-degree of vertex 1 = 2

Out-degree of vertex 2 = 1

Out-degree of vertex 3 = 1

Out-degree of vertex 4 = 0

Note

Pendant Vertex

A vertex with degree one is called a pendant vertex.

Isolated Vertex

A vertex with degree zero is called an isolated vertex.