Fix transition() matrix for weighted graphs