Professional Documents
Culture Documents
CS 7280 L2
CS 7280 L2
Lesson 2
Undirected Graphs
Adjacency Matrix
Adjacency List
● The adjacency list representation of a graph requires n+2*m space due to including each
edge twice.
● Adjacency matrices and lists differ significantly when the graph is sparse.
● A graph is considered sparse when the number of edges (m) is much closer to the
number of nodes (n) than to the maximum number of edges (n-choose-2).
● In a sparse graph, the adjacency matrix consists mostly of zeros.
● On the other hand, a graph is referred to as dense if the number of edges is much closer
to the maximum number of edges (n-choose-2) than to the number of nodes (n).
● It should be noted that most real-world networks tend to be sparse.
● The sparsity of real-world networks can be attributed to the associated cost of each edge
in technological, biological, and social networks.
● Dense networks would be more expensive to construct and maintain in such cases.