node_levels function

Defines a level for every node in the net