diff --git a/spectral-clustering.cabal b/spectral-clustering.cabal
--- a/spectral-clustering.cabal
+++ b/spectral-clustering.cabal
@@ -1,6 +1,6 @@
 cabal-version: >=1.10
 name: spectral-clustering
-version: 0.2.2.0
+version: 0.2.2.2
 license: GPL-3
 license-file: LICENSE
 copyright: 2019 Gregory W. Schwartz
diff --git a/src/Math/Clustering/Spectral/Dense.hs b/src/Math/Clustering/Spectral/Dense.hs
--- a/src/Math/Clustering/Spectral/Dense.hs
+++ b/src/Math/Clustering/Spectral/Dense.hs
@@ -79,7 +79,7 @@
 b1ToB2 :: B1 -> B2
 b1ToB2 (B1 b1) =
     B2
-      . cimap (\ !i !j !x -> (log (fromIntegral n / (fromMaybe 0 $ dVec VS.!? j))) * x)
+      . cimap (\ !i !j !x -> (log (fromIntegral n / (fromMaybe (error "Missing degree for observation. This would lead to divide by 0 error.") $ dVec VS.!? j))) * x)
       $ b1
   where
     dVec :: H.Vector Double
@@ -93,20 +93,20 @@
 -- | Euclidean norm each row.
 b2ToB :: B2 -> B
 b2ToB (B2 b2) =
-    B . cimap (\ !i !j !x -> x / (fromMaybe 0 $ eVec VS.!? i)) $ b2
+    B . cimap (\ !i !j !x -> x / (fromMaybe (error "Missing degree for observation. This would lead to divide by 0 error.") $ eVec VS.!? i)) $ b2
   where
     eVec :: H.Vector Double
     eVec = H.fromList . fmap H.norm_2 . H.toRows $ b2
     n = H.rows b2
     m = H.cols b2
 
--- | Get the diagonal transformed B matrix.
+-- | Get the signed diagonal transformed B matrix.
 bToD :: B -> D
 bToD (B b) = D
            . H.diag
            . H.flatten
            $ b
-        H.<> ((H.tr b) H.<> ((n H.>< 1) [1,1..]))
+        H.<> ((H.cmap abs $ H.tr b) H.<> ((n H.>< 1) [1,1..]))
   where
     n = H.rows b
 
@@ -237,10 +237,10 @@
           $ mat
     i     = H.ident . H.rows $ mat
 
--- | Obtain the degree matrix.
+-- | Obtain the signed degree matrix.
 getDegreeMatrix :: AdjacencyMatrix -> H.Matrix Double
 getDegreeMatrix = H.diag . getDegreeVector
 
--- | Obtain the degree vector.
+-- | Obtain the signed degree vector.
 getDegreeVector :: AdjacencyMatrix -> H.Vector Double
-getDegreeVector = H.vector . fmap H.sumElements . H.toRows
+getDegreeVector = H.vector . fmap (H.sumElements . H.cmap abs) . H.toRows
diff --git a/src/Math/Clustering/Spectral/Eigen/AdjacencyMatrix.hs b/src/Math/Clustering/Spectral/Eigen/AdjacencyMatrix.hs
--- a/src/Math/Clustering/Spectral/Eigen/AdjacencyMatrix.hs
+++ b/src/Math/Clustering/Spectral/Eigen/AdjacencyMatrix.hs
@@ -173,10 +173,10 @@
                   . S.toList
                   $ m
 
--- | Obtain the degree matrix. Faster for columns.
+-- | Obtain the signed degree matrix. Faster for columns.
 getDegreeMatrix :: AdjacencyMatrix -> S.SparseMatrixXd
 getDegreeMatrix = S.diagRow 0 . getDegreeVector
 
--- | Obtain the degree vector. Faster for columns.
+-- | Obtain the signed degree vector. Faster for columns.
 getDegreeVector :: AdjacencyMatrix -> S.SparseMatrixXd
-getDegreeVector = S.getColSums
+getDegreeVector = S.getColSums . S._map abs
diff --git a/src/Math/Clustering/Spectral/Eigen/FeatureMatrix.hs b/src/Math/Clustering/Spectral/Eigen/FeatureMatrix.hs
--- a/src/Math/Clustering/Spectral/Eigen/FeatureMatrix.hs
+++ b/src/Math/Clustering/Spectral/Eigen/FeatureMatrix.hs
@@ -77,9 +77,9 @@
     eVec :: VS.Vector Double
     eVec = VS.fromList . fmap S.norm . S.getRows $ b2
 
--- | Get the diagonal transformed B matrix.
+-- | Get the signed diagonal transformed B matrix.
 bToD :: B -> D
-bToD (B b) = D . S.diagCol 0 $ b * ((S.transpose b) * S.ones n)
+bToD (B b) = D . S.diagCol 0 $ b * ((S._map abs $ S.transpose b) * S.ones n)
   where
     n = S.rows b
 
diff --git a/src/Math/Clustering/Spectral/Sparse.hs b/src/Math/Clustering/Spectral/Sparse.hs
--- a/src/Math/Clustering/Spectral/Sparse.hs
+++ b/src/Math/Clustering/Spectral/Sparse.hs
@@ -95,13 +95,13 @@
 norm2 :: S.SpVector Double -> Double
 norm2 = sqrt . sum . fmap (** 2)
 
--- | Get the diagonal transformed B matrix.
+-- | Get the signed diagonal transformed B matrix.
 bToD :: B -> D
 bToD (B b) = D
            . S.diagonalSM
            . flip S.extractCol 0
            $ b
-       S.#~# ((S.transposeSM b) S.#~# (S.fromColsL [S.onesSV n]))
+       S.#~# ((fmap abs $ S.transposeSM b) S.#~# (S.fromColsL [S.onesSV n]))
   where
     n = S.nrows b
 
@@ -202,6 +202,7 @@
              . S.vr
              . fmap ((\x -> if x == 0 then x else x ** (- 1 / 2)) . sum)
              . S.toRowsL
+             . fmap abs -- signed diagonal
              $ mat
     i        = S.eye . S.nrows $ mat
 
