Weighted Graph
A weighted graph associates a numerical cost, distance, time, capacity, or other metric with each edge. Algorithms such as Dijkstra, Bellman-Ford, and Floyd-Warshall use these weights when computing shortest paths.
Weights represent application-specific costs.
Weights may be positive, zero, or negative depending on the algorithm.
Dijkstra requires non-negative edge weights.
Bellman-Ford can handle negative weights.
Weights can exist on directed or undirected edges.