networkx 2.8.2 Pypi GitHub Homepage
Other Docs
NotesParametersBackRef
add_weighted_edges_from(self, ebunch_to_add, weight='weight', **attr)

Notes

Adding the same edge twice for Graph/DiGraph simply updates the edge data. For MultiGraph/MultiDiGraph, duplicate edges are stored.

Parameters

ebunch_to_add : container of edges

Each edge given in the list or container will be added to the graph. The edges must be given as 3-tuples (u, v, w) where w is a number.

weight : string, optional (default= 'weight')

The attribute name for the edge weights to be added.

attr : keyword arguments, optional (default= no attributes)

Edge attributes to add/update for all edges.

Add weighted edges in :None:None:`ebunch_to_add` with specified weight attr

See Also

add_edge

add a single edge

add_edges_from

add multiple edges

Examples

>>> G = nx.Graph()  # or DiGraph, MultiGraph, MultiDiGraph, etc
... G.add_weighted_edges_from([(0, 1, 3.0), (1, 2, 7.5)])
See :

Back References

The following pages refer to to this document either explicitly or contain code examples using this.

networkx.classes.graph.Graph.add_edges_from networkx.algorithms.approximation.traveling_salesman.simulated_annealing_tsp networkx.classes.graph.Graph.add_weighted_edges_from networkx.algorithms.tree.branchings.branching_weight networkx.classes.multigraph.MultiGraph.add_edges_from networkx.algorithms.approximation.traveling_salesman.greedy_tsp networkx.classes.function.is_negatively_weighted networkx.algorithms.shortest_paths.weighted.johnson networkx.algorithms.approximation.traveling_salesman.threshold_accepting_tsp networkx.algorithms.matching.max_weight_matching networkx.algorithms.shortest_paths.dense.floyd_warshall_predecessor_and_distance networkx.algorithms.flow.networksimplex.network_simplex networkx.classes.digraph.DiGraph.add_edges_from networkx.algorithms.shortest_paths.weighted.find_negative_cycle

Local connectivity graph

Hover to see nodes names; edges to Self not shown, Caped at 50 nodes.

Using a canvas is more power efficient and can get hundred of nodes ; but does not allow hyperlinks; , arrows or text (beyond on hover)

SVG is more flexible but power hungry; and does not scale well to 50 + nodes.

All aboves nodes referred to, (or are referred from) current nodes; Edges from Self to other have been omitted (or all nodes would be connected to the central node "self" which is not useful). Nodes are colored by the library they belong to, and scaled with the number of references pointing them


GitHub : /networkx/classes/graph.py#957
type: <class 'function'>
Commit: