next | previous | forward | backward | up | top | index | toc | Macaulay2 website
Graphs :: degreeMatrix

degreeMatrix -- Returns the degree matrix of a graph

Synopsis

Description

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}});
i2 : degreeMatrix G

o2 = | 1 0 0 0 0 |
     | 0 2 0 0 0 |
     | 0 0 3 0 0 |
     | 0 0 0 2 0 |
     | 0 0 0 0 2 |

              5        5
o2 : Matrix ZZ  <--- ZZ

See also

Ways to use degreeMatrix :

For the programmer

The object degreeMatrix is a method function.