Enhanced implementation techniques


An adjacency list is an easy and effective way to implement a graph in memory. However, just like adjacency matrices, some more complicated use cases cannot be implemented with the most basic implementation of adjacency lists.

Adjacency list implementation cannot store:

  • Weighted edges
  • Data value at nodes

Adjacency list cannot store graphs with edge weights and node data

The basic implementation of an adjacency list only stores the relationship between nodes and nothing about the node. Also, it only stores the existence of an edge between two nodes, so it cannot store any additional edge data, such as weights. Let us look at how to modify the implementation to store this data.

Liking the course? Check our discounted plans to continue learning.