We can also represent a graph using an incidence matrix. In an incidence matrix, each row of the matrix represents a vertex, and each column represents an edge. We will represent the connectivity between two objects using a two-dimensional array, as array[v][e] === 1 if the vertex v is an incident upon edge e or as array[v][e] === 0 otherwise, as demonstrated in the following diagram:
An incidence matrix is usually used to save space and memory when we have more edges than vertices.