dynetworkx.SnapshotGraph.degree

SnapshotGraph.degree(sbunch=None, nbunch=None, weight=None)

Return a list of tuples containing the degrees of each node in each snapshot

Parameters:
  • sbunch (container of snapshot indexes, optional (default= None)) – Each snapshot index in this list will be included in the returned list of node degrees. It is highly recommended that this list is sequential, however it can be out of order.
  • nbunch (container of nodes, optional (default= None)) – Each node in the nbunch list will be included in the returned list of node degrees.
  • weight (string, optional (default= None)) – The edge attribute that holds the numerical value used as a weight. If None, then each edge has weight 1. The degree is the sum of the edge weights adjacent to the node.
Returns:

degree_list – List of DegreeView objects containing the degree of each node, indexed by requested snapshot.

Return type:

list

Examples

>>> G = dnx.SnapshotGraph()
>>> G.add_snapshot([(1, 2), (1, 3)])
>>> G.add_snapshot([(1, 4), (1, 3)])
>>> G.degree(sbunch=[1])
[DegreeView({1: 2, 4: 1, 3: 1})]
>>> G.degree(nbunch=[1, 2])
[DegreeView({1: 2, 2: 1}), DegreeView({1: 2})]