Search⌘ K
AI Features

Weighted Graphs

Explore the concept of weighted graphs by understanding how real numbers assigned to edges represent costs or quantities. Learn about vertex and edge attributes and how to store this information in data structures like adjacency matrices. This lesson helps you grasp the foundational ways to represent and work with weighted graphs for various algorithms.

We'll cover the following...

Vertex and edge attributes

One of the things deeply ingrained in every computer science student is that objects have properties. So, if we put on our object-orientation hat, it’s clear that graphs are objects and so are vertices and edges.

The graph representation chosen for an application can be extended to store additional information for the vertices and edges. In some cases, it may be a good idea to store the information in a second data structure (such as a two-dimensional array) with a structure similar to an adjacency matrix. This is especially true ...