# Implementing weighted graphs in Python

# Weighted Graphs

A

weighted graphis agraphin which each branch is given a numericalweight. Therefore it is a special type of labeledgraphin which the labels are numbers (which are usually taken to be positive).

# Applications of Weighted Graphs

Maps with weights representing distances.

Water networks with weights representing water capacity of pipes.

Electrical circuits with weights representing resistance or maximum voltage or maximum current.

Computer or phone networks with weights representing length of wires between nodes.

One of the canonical applications for weighted graphs is finding the **shortest path between two nodes**. These algorithms are used in **Google Maps** for example.