dynetworkx.SnapshotGraph.__len__

SnapshotGraph.__len__()

Return the number of snapshots. Use: ‘len(G)’.

Returns:num_snapshots – The number of snapshots in the graph.
Return type:int

Examples

>>> nxG1 = nx.Graph()
>>> nxG2 = nx.Graph()
>>>
>>> nxG1.add_edges_from([(1, 2), (1, 3)])
>>> nxG2.add_edges_from([(1, 4), (1, 3)])
>>>
>>> G = dnx.SnapshotGraph()
>>> G.add_snapshot(graph=nxG1)
>>> G.add_snapshot(graph=nxG2)
>>> len(G)
2