Graphs 379
8.4.2 Deletion Operation
The deletion of a vertex and its associated edges from an adjacency matrix, for directed and undirected
graph, involves the following operations:
(1) Deleting the row corresponding to the vertex.
(2) Deleting the col corresponding to the vertex.
The algorithm is straight forward and given below:
Algorithm delVertex (verTex)
{
find the row corresponding to verTex and set all its elements = ‘0’;
find the col corresponding to verTex and set all its elements = ‘0’;
}
The deletion of an edge from a graph requires different treatment for undirected and directed
graphs. Both the cases of deletion of edges ...