NetworkX

Previous topic

networkx.MultiDiGraph.edges

Next topic

networkx.MultiDiGraph.get_edge

Quick search

networkx.MultiDiGraph.edges_iter

MultiDiGraph.edges_iter(nbunch=None, data=False)

Return an iterator over the edges.

Parameters:

nbunch : list, iterable

A container of nodes that will be iterated through once (thus it should be an iterator or be iterable). Each element of the container should be a valid node type: any hashable type except None. If nbunch is None, return all edges in the graph. Nodes in nbunch that are not in the graph will be (quietly) ignored.

data : bool

Return two tuples (u,v) (False) or three-tuples (u,v,data) (True)

Returns:

An iterator over edges that are adjacent to any node in nbunch, :

or over all edges if nbunch is not specified. :

Examples

>>> G=nx.path_graph(4)
>>> G.edges()
[(0, 1), (1, 2), (2, 3)]
>>> G.edges(data=True) # default edge data is 1
[(0, 1, 1), (1, 2, 1), (2, 3, 1)]