# How to express this in matrix notation (row-wise normalisation)

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.

-
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

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)$