dynetx.DynDiGraph.degree_iter

DynDiGraph.degree_iter(nbunch=None, t=None)

Return an iterator for (node, degree) at time t.

The node degree is the number of edges adjacent to the node in a given timeframe.

Parameters:
  • nbunch (iterable container, optional (default=all nodes)) – A container of nodes. The container will be iterated through once.
  • t (snapshot id (default=None)) – If None will be returned an iterator over the degree of nodes on the flattened graph.
Returns:

nd_iter – The iterator returns two-tuples of (node, degree).

Return type:

an iterator

See also

degree()

Examples

>>> import dynetx as dn
>>> G = dn.DynDiGraph()
>>> G.add_interaction(0, 1, t=0)
>>> list(G.degree_iter(0, t=0))
[(0, 1)]
>>> list(G.degree_iter([0,1], t=0))
[(0, 1), (1, 1)]