function numEquations = computeEquationNumber(nDof, element_data)
nElements = length(element_data);
numEquations = {};

for i = 1:nElements
    elementConnectivity = element_data{i}{2};
    
    if elementConnectivity(1) == elementConnectivity(2)  % spring element
        % For spring element, store the single equation number
        numEquationsElem = (elementConnectivity(1)-1) * nDof + element_data{i}{3};
    else
        numEquationsElem =[];
        for j = 1:length(elementConnectivity)
            numEquationsElem = [numEquationsElem,(elementConnectivity(j)-1) * nDof + (1:nDof)];
        end
    end
    numEquations{i} = numEquationsElem;  % Store the equation numbers for the element
end
end