How it works...

Let's assume we are working with the following directed graph:

Figure 10.9

The adjacency list representation of this graph is as follows:

Figure 10.10

We define a structure called "node" comprising the following three members:

  • nme: This is for storing the vertex.
  • vrt: A pointer to connect all the vertices of the graph.
  • edg: A pointer that connects all the vertices that are connected to the current vertex:

Figure 10.11

The user ...

Get Practical C Programming now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.