function [eid] = matlabGetEdge (gx, gy, ori, max_clm_idx)


if (ori == 0)
    %% EAST
    eid = (max_clm_idx)*(max_clm_idx-1) + (gx-1)*(max_clm_idx) + gy ;
else
    % NORTH
    eid = (gx-1)*(max_clm_idx-1) + gy ;
end
% 
% if(ori==0)
%     display('east');
% else
%     display('north');
% end
