Skip to main content

What does edge weight mean?

Edge weight is a numeric value that describes the characteristic of the connection between two vertices.

The weight shows how "expensive", "long", or "hard" it is to move from one vertex to another.


Examples of what weight means

  • On a road map, it is the distance between cities (km).
  • In a transport network, it is the travel time (minutes).
  • In economics, it is the shipping cost or tariff.
  • In a social network, it is the strength of the connection between users (frequency of contact).

Usage

Edge weight is used in algorithms that need to find the optimal path:

  • minimum weight → the shortest, cheapest, or fastest path;
  • maximum weight → the strongest or highest-priority connection.

Summary: edge weight is a numeric "price" of a connection between vertices, whose value depends on the context of the problem.

Short Answer

Interview ready
Premium

A concise answer to help you respond confidently on this topic during an interview.