function [B,BS] = Hessian_reg(data, KNSize, Dim)

    TanParam.DimGiven = 1;
    TanParam.NCoordDim = Dim;
    Nodes = data';

    %       if Labels.LFlag(i)=1, 'i'-th node is a labeled point.
    %       if Labels.LFlag(i)=0, 'i'-th node is not a labeled point.
    %[NNIdx, ~] = slfindnn(Nodes', [], 'knn', 'K', KNSize) ;%
    %NNIdx = cell2mat(NNIdx)';
    [NNIdx, x] = GetKNN(Nodes, KNSize);
    [B,BS] = ConstructHessian(Nodes, NNIdx, TanParam);
    
end