Note

This is the documentation for the current state of the development branch of rustworkx. The documentation or APIs here can change prior to being released.

rustworkx.PyGraph.add_edges_from#

PyGraph.add_edges_from(obj_list, /)#

Add new edges to the graph.

Parameters:

obj_list (iterable[tuple[int, int, T]]) – An iterable of tuples of the form (node_a, node_b, T) to attach to the graph. node_a and node_b are integer indices describing where an edge should be added, and T is the python object for the edge data.

If multigraph is False and an edge already exists between node_a and node_b the weight/payload of that existing edge will be updated to be edge. This will occur in order from obj_list so if there are multiple parallel edges in obj_list the last entry will be used.

Returns:

A list of indices of the newly created edges

Return type:

EdgeIndices