function [newInx, nodePerm] = GetNodeInxPermutation(inx, nodePerm)

newInx = -1;
numNodes = size(nodePerm,1);

for n =1:numNodes
    if nodePerm(n,2) == inx
        newInx = nodePerm(n,1);
        break;
    end
end

if newInx == -1
    newInx = numNodes +1;
    nodePerm(newInx,1) = newInx;
    nodePerm(newInx,2) = inx;
end
    