im sorry if this is a trivial question. As the title stated, how is the degree matrix of a directed graph defined? I looked up wikipedia of degree matrix but there was no defitnition of it. Instead they reffered the indegree and outdegree. I was wondering if we can represent a degree matrix of directed graph. Can someone help me with this?
$\endgroup$ 21 Answer
$\begingroup$You just put either out- or in-degrees (whatever you like/need more) on the main diagonal. For example in a graph with vertices $V = \{1, 2, 3\}$ and oriented edges $(1, 2)$ and $(1, 3)$ and $(2, 3)$ the out-degree matrix is $$\begin{pmatrix} 2 & 0 & 0 \\ 0 & 1 & 0 \\ 0 & 0 & 0 \end{pmatrix}$$ and the in-degree matrix is $$\begin{pmatrix} 0 & 0 & 0 \\ 0 & 1 & 0 \\ 0 & 0 & 2 \end{pmatrix}.$$ Note that you also can treat your graph as undirected (discard the orientation of every edge), in which case the degree matrix will be $$\begin{pmatrix} 2 & 0 & 0 \\ 0 & 2 & 0 \\ 0 & 0 & 2 \end{pmatrix}.$$ Which one you need depends on the particular problem you are facing, however I'm afraid I can't tell without more context.
$\endgroup$ 4