This algorithm only accepts networks with undirected edges. It cannot work with directed edges. This algorithm also treats unweighted networks as networks whose edge weights are all 1.
For each node node[i], this algorithm calculates the total node degree (degree(node[i])) and the total node strength (strength(node[i])), where:
- degree(node[i]) = total degree of node[i] = number of edges node[i] is connected to
- strength(node[i]) = the sum of the weights of all of the edges node[i] is connected to
Given the nature of the node strength, if the input network is unweighted, the node degree will always equal the node strength for all nodes.
This algorithm outputs a version of the input network, annotated with the degree and strength node attributes.
This algorithm was written by Duygu Balcan and integrated by Russell Duhon.