A follow-up of my comment in this link above.
This version of Euclidean Projection perfectly well.
But this time I had to normalize/divide my input signal with a small coefficient (like a scalar value=0.005).
When I run this function on those signals cvx status is shown as Failed with optval as NaN but then the final result which I got is a valid Laplacian matrix satisfying all of the constraints. The graph I procured from this Laplacian matrix is also perfectly good after visualizing it.
If I comment the constraint vec(Z-diag(diag(X))) <= 0
and run my cvx code. The status now is solved with some optvalue but the final result is not a valid Laplacian since it fails to meet vec(Z-diag(diag(X))) <= 0
constraint.
This looks a bit confusing for me.