(A). In case of a directed graph, the sum of lengths of all the adjacency list is $|E|$
(B). For an undirected graph, the sum of the lengths of all the adjacency list is $2|E|$
(C). For a dense graph, adjacency matrix representation is preferable
(D). The memory requirement of the adjacency matrix of a graph is dependent on the number of edges
Choose the correct answer from the options given below:
1. (A), (B) and (D) only
2. (A), (B) and (C) only
3. (A), (B), (C) and (D)
4. (B), (C) and (D) only
This solution analyzes the truthfulness of four statements concerning graph data structures, specifically focusing on adjacency lists and adjacency matrices for both directed and undirected graphs.
This statement concerns directed graphs and the sum of the lengths of their adjacency lists. In a directed graph, an edge from vertex u to vertex v is represented by adding v to the adjacency list of u. Each directed edge corresponds to exactly one entry in one adjacency list (the list of its source vertex).
Therefore, statement (A) is TRUE.
This statement deals with undirected graphs and the sum of lengths of their adjacency lists. In an undirected graph, an edge between vertices u and v means that v is in the adjacency list of u, and u is in the adjacency list of v.
Therefore, statement (B) is TRUE.
This statement discusses the preference for adjacency matrix representation in dense graphs. A dense graph is one where the number of edges, $|E|$, is close to the maximum possible number of edges, which is approximately $|V|^2$ for a graph with $|V|$ vertices.
Therefore, statement (C) is TRUE.
This statement claims that the memory requirement of an adjacency matrix is dependent on the number of edges ($|E|$). Let's examine the memory requirements for graph representations.
Since the memory for an adjacency matrix depends on $|V|^2$ and not $|E|$, statement (D) is FALSE.
Based on the analysis:
The statements that are true are (A), (B), and (C).
Matching this with the given options, the correct choice is the one that includes only (A), (B), and (C).