Often the edges of some graph are associated with a particular cost, perhaps the cost of traversing that edge.

A weighted undirected graph is an ordered pair $((V, E),w)$ where $(V, E)$ is an undirected graph and $w: E \to \R $ is an unordered weight function.

A weighted directed graph is an ordered pair $((V, F),\omega )$ where $(V, E)$ is an digraph and $\omega : F \to \R $ is an ordered weight function (or weight function).