Added a function to determine the 'weight' of a node.