Cosmic complexity of structures:
Adjacency: O (V ^ 2) Incidence: O (VE)
Due to the fact that the incidence structure saves space if the number of vertices is greater than the edges.
You can see the time complexity of some typical graph operations:
Find all vertices adjacent to the vertex: Adj: O (V) Inc: O (VE)
Check if two vertices are adjacent: Adj: O (1) Inc: O (E)
Count the top valency: Adj: O (V) Inc: O (E)
And so on. For any given algorithm, you can use building blocks, as described above, to calculate which representation gives you the best overall time complexity.
As a last note, using any matrix is ββextremely inefficient for everyone except the busiest schedules, and I recommend not using them if you have not knowingly rejected alternatives such as adjacency lists.
user168715
source share