Added ability to specify node weights.