Weighted graph
A weighted graph is a graph whose edges have associated values representing quantities such as cost, distance, strength, or frequency.
Classic Computer Science Problems in Swift: Essential techniques for practicing programmers
A weighted graph is a graph whose edges have associated values representing connection costs or other quantities.
- How it is used
- Represents connection distances for minimum-cost network construction and shortest routes between cities.
- How deep it goes
- Builds generic weighted edges and adjacency lists, then walks through priority-queue implementations of spanning-tree and shortest-path searches.
- Examples
- Uses mile-weighted links among 15 U.S. metropolitan areas, a 5372-mile spanning tree, and a 2605-mile Los Angeles–Boston route.
- What you can do after
- Build it from scratch as a generic Swift graph and apply it to minimum spanning trees and single-source shortest paths.
Optimization Algorithms: AI techniques for design, planning, and control problems
A graph whose edges have numerical weights representing quantities such as distance or cost.
- How it is used
- Models distances, costs, times, or connection speeds so graph routes and relationships can be compared quantitatively.
- How deep it goes
- Defines edge weights and demonstrates NetworkX construction, then connects them to shortest-path search without deriving algorithm internals.
- Examples
- Uses road networks with distance or cost and telecommunications devices whose edges carry Mbps connection speeds.
- What you can do after
- Operate/configure weighted graphs with NetworkX and visualize nodes, edges, and numerical labels.
Graph Algorithms for Data Science
A weighted network is a graph whose relationships carry numerical values representing strength, cost, frequency, or another quantity.
- How it is used
- Represents relationship strength or traversal cost in network models.
- How deep it goes
- Defines numerical relationship weights and explains when higher or lower values are preferred.
- Examples
- Uses friendship relationships, transportation networks, and projected retweet networks as examples of weighted analysis.
- What you can do after
- Evaluate whether relationship values should be maximized for strength or minimized for traversal cost.
Read how Graph Algorithms for Data Science explains weighted graph →
Related concepts
- graphkind of · A graph is a mathematical structure consisting of vertices connected by edges that represent relationships or connections.
- unweighted graphcontrasts with · An unweighted graph is a graph whose edges have no assigned numerical weights.
- Dijkstra's algorithmused by · Dijkstra's algorithm computes shortest paths from a source vertex in a weighted graph with nonnegative edge weights.
- UMAPused by · UMAP, or Uniform Manifold Approximation and Projection, is a nonlinear manifold-learning technique that embeds high-dimensional data in a lower-dimensional space while preserving important neighborhood and structural relationships.
- weighthas part · A weight is a numerical quantity assigned to an element to represent its contribution, influence, importance, strength, or resource amount in a calculation or system.
These guides are generated from the text of Manning books by Manning's knowledge graph and link to the sections they draw on. The full books are available on liveBook and at manning.com.


