The degree matrix is the n by n diagonal matrix (where n is the number of vertices in the vertex set of the graph G) indexed by the vertices of G where A(u,u) is the degree of vertex u. The degree of a vertex u is the number of edges such that u,v is an edge for any v also in the vertex set. This matrix is always diagonal.
i1 : G = graph({1,2,3,4,5},{{1,2},{2,3},{3,4},{3,5},{4,5}});