NetworkX

Previous topic

networkx.MultiGraph.add_edge

Next topic

networkx.MultiGraph.remove_edge

Quick search

networkx.MultiGraph.add_edges_from

MultiGraph.add_edges_from(ebunch, data=1)

Add all the edges in ebunch.

Parameters:

ebunch : list or container of edges

The container must be iterable or an iterator. It is iterated over once. Adding the same edge twice has no effect and does not raise an exception. The edges in ebunch must be 2-tuples (u,v) or 3-tuples (u,v,d).

data : any Python object The default data for edges with no data given. If unspecified the integer 1 will be used.

See also

add_edge

Examples

>>> G=nx.Graph()
>>> 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