sequential numbering of nodes using max id