rustworkx.PyGraph.extend_from_weighted_edge_list#

PyGraph.extend_from_weighted_edge_list(edge_list, /)#

Extend graph from a weighted edge list

This method differs from add_edges_from() in that it will add nodes if a node index is not present in the edge list.

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.

Parameters:

edge_list (list) – A list of tuples of the form (source, target, weight) where source and target are integer node indices. If the node index is not present in the graph, nodes will be added (with a node weight of None) to that index.