Incidence Matrix
For this implementation we use a matrix
rows, representing the vertices columns, representing the edges - For every column
, we put a in the row corresponding to the vertices connected by edge represented by the column (ex: )
- For every column
Example: this undirected graph right here, would be implemented like this


All the columns are different from each other, since they represent different kind of information.
In the case we face a directed graph:
if the edge is incident from/ leaves vertex , if the edge is incident to/ enters vertex .
Conclusions
Best for sparse graphs