Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

My questions are:

  1. How do I describe the row sum of a matrix?
  2. How do I describe the number of non-zero elements per row of a matrix in matrix notation?
  3. How do I divide a vector elementwise?

To give you context:

I have a graph $(V,E,\mathbf{W})$ where $\mathbf{W} \in \mathbb{R}^{n\times n}$ is a weight matrix describing the edges $E$ connecting vertices $V$. I also have a vector $\mathbf{c} \in \mathbb{R}^{n \times 1}$ containing values at each edge.

The elements in $\mathbf{c}$ are updated like this:

$c_i(t+1) = \frac{1}{|V_i|} \sum_{j \in V_i} w_{ij} c_j(t)$

where $V_i$ is the set of neighbours of vertex $i$ and $|V_i|$ denotes the number of nodes in the set. I would like to express this using matrix notation.

share|cite|improve this question
Since you have solved it, it would be nice to post this as an answer to your own question. This also takes it off the "unanswered" list. – Andrew Salmon Sep 15 '13 at 4:16
You're right - I added the solution as an answer now. – Lisa Sep 16 '13 at 11:44
up vote 1 down vote accepted

Let $\mathbf{A}$ be the adjaciency matrix of the unweighted equivalent to $G$ and $\mathbf{D}$ is the corresponding diagonal degree matrix (the sum of all outgoing connections of a node, also the row-sum). $\mathbf{c}(t+1)$ can then be expressed by:

$\mathbf{c}(t+1) = \mathbf{D}^{-1} \mathbf{W} \mathbf{c}(t) $

share|cite|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.