Add all the edges in ebunch.
Parameters : | ebunch : container of edges
attr_dict : dictionary, optional (default= no attributes)
attr : keyword arguments, optional
|
---|
See also
Notes
Adding the same edge twice has no effect but any edge data will be updated when each duplicate edge is added.
Examples
>>> G = nx.Graph() # or DiGraph, MultiGraph, MultiDiGraph, etc
>>> G.add_edges_from([(0,1),(1,2)]) # using a list of edge tuples
>>> e = zip(range(0,3),range(1,4))
>>> G.add_edges_from(e) # Add the path graph 0-1-2-3
Associate data to edges
>>> G.add_edges_from([(1,2),(2,3)], weight=3)
>>> G.add_edges_from([(3,4),(1,4)], label='WN2898')