How it works...
Assuming that the directed graphs the user will specify in this program will not be of more than 10 vertices, define a macro called max of value 10 and a two-dimensional matrix called edg, consisting of max rows and max columns. However, you can always increase the size of the macro if you think the user can specify a graph of more than 10 vertices.
In order to initialize all of the elements of the edg matrix to 0, define it as a static matrix. Thereafter, the user will be prompted to specify how many vertices there are in the graph. Suppose the user enters 5 to indicate that there are 5 vertices in the graph, then that value will be assigned to the numb variable.
To make the recipe easy to understand, we assume that the ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access