dynetworkx.SnapshotGraph.add_edges_from

SnapshotGraph.add_edges_from(ebunch, sbunch=None, **attrs)

Adds edges to snapshots in sbunch.

Parameters:
  • ebunch (container of edges) – Each edge in the ebunch list will be added to all graphs indexed in sbunch.
  • 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.
Returns:

Return type:

None

Examples

>>> G = dnx.SnapshotGraph()
>>> G.add_snapshot([(1, 2), (1, 3)])
>>> G.add_snapshot([(1, 4), (1, 3)])
>>> G.add_edges_from([(5, 6), (7, 6)], [0])
>>> G.add_edges_from([(8, 9), (10, 11)], [0, 1])
>>> nx.adjacency_matrix(G.get()[0]).todense()
[[0 1 1 0 0 0 0 0 0 0]
 [1 0 0 0 0 0 0 0 0 0]
 [1 0 0 0 0 0 0 0 0 0]
 [0 0 0 0 1 0 0 0 0 0]
 [0 0 0 1 0 1 0 0 0 0]
 [0 0 0 0 1 0 0 0 0 0]
 [0 0 0 0 0 0 0 1 0 0]
 [0 0 0 0 0 0 1 0 0 0]
 [0 0 0 0 0 0 0 0 0 1]
 [0 0 0 0 0 0 0 0 1 0]]
>>> nx.adjacency_matrix(G.get()[1]).todense()
[[0 1 1 0 0 0 0]
 [1 0 0 0 0 0 0]
 [1 0 0 0 0 0 0]
 [0 0 0 0 1 0 0]
 [0 0 0 1 0 0 0]
 [0 0 0 0 0 0 1]
 [0 0 0 0 0 1 0]]