dynetworkx.IntervalGraph.number_of_nodes

IntervalGraph.number_of_nodes(begin=None, end=None)

Return the number of nodes in the interval graph between the given interval.

Parameters:
  • begin (int or float, optional (default= beginning of the entire interval graph)) – Inclusive beginning time of the node appearing in the interval graph.
  • end (int or float, optional (default= end of the entire interval graph + 1)) – Non-inclusive ending time of the node appearing in the interval graph. Must be bigger than or equal begin. Note that the default value is shifted up by 1 to make it an inclusive end.
Returns:

nnodes – The number of nodes in the interval graph.

Return type:

int

See also

__len__()

Examples

>>> G = dnx.IntervalGraph()
>>> G.add_edges_from([(1, 2, 0, 5), (3, 4, 8, 11)])
>>> len(G)
4
>>> G.number_of_nodes()
4
>>> G.number_of_nodes(begin=6)
2
>>> G.number_of_nodes(begin=5, end=8) # end in non-inclusive
2
>>> G.number_of_nodes(end=8)
4