This week we focus heavily on the intricacies of different graphs. Before we talk about the pros and cons of adjacency list representation of a weighted graph representation, let’s first define what adjacency list representation even is. To put it simply this is an array that shows the connections (or edges) of a graph instead of showing the physical graph itself.
I don’t know much about it from a programmer’s perspective, but as someone reading these graphs, the first disadvantage that comes to mind is the time cost. Both the functional way these graphs are designed and the visual aspect as well do not lend themselves to speed and efficiency. Visually it’s much easier to simply draw out the edges and consider the graph as a whole instead. Functionally, (especially on complex graphs with many edges) an algorithm may have to unnecessarily check all the vertices in a graph to answer a query.
The advantage of these graphs is that it is well suited for storing a smaller more simple graph. In a simple scenario, the speed efficiency would be less of a factor.
B. Please comment to Nicholas M on this comment he made in 137 words.
I learned a lot after reading this weeks chapter on graphs and algorithms. When it comes to a disadvantage of using an adjacency list representation of a weighted graph, the one that comes to mind for me is that an adjacency list representation of a weighted graph will not account for the edges weight or cost. This can be a huge disadvantage if the users of the weighted graph are trying to see what the weight is from one vertex to another vertex. The issue that comes with this is, for example, if the weighted graph shows the times it takes to travel from one city to another and the user is trying to find the fastest path, there is no simple way to see that. In short, while an adjacency list representation of a weighted graph can be used and will show what vertices are adjacent to others, it does not show the weight between them. While I am sure there are other disadvantages to using an adjacency list representation for a weighted graph, this is the one that I found and understood from this weeks reading.