Skip to main content

Weighted Graph

Learn Weighted Graph (Graphs, Advanced DSA) with worked examples, diagrams and interview questions. Free on JavaSchoolLab.

Edges With a Cost, Not Just a Connection A weighted graph attaches a NUMBER to each edge - distance, cost, time, capacity. This single addition changes which algorithms apply: plain BFS finds shortest paths only in UNWEIGHTED graphs (every edge "costs" 1); weighted graphs need Dijkstra, Bellman-Ford, or Floyd-Warshall instead.

More lessons in Graphs