Representing Weighted Graphs
Explore how weighted graphs can be implemented.
We'll cover the following...
Let’s see how we can adapt the graph representations introduced in the previous lessons to weighted graphs. Throughout this lesson, we’ll use the following weighted graph as a running example:
An example weighted graph
Weighted adjacency matrix
To represent a weighted graph using its adjacency matrix, we can simply use a matrix of integers instead of booleans. The entry will be when there is no edge from to ...