What is the order of the adjacency matrix corresponding to a graph with ‘n’ nodes and ‘m’ edges?

What is the order of the adjacency matrix corresponding to a graph with ‘n’ nodes and ‘m’ edges? Correct Answer n × n

  • Adjacency Matrix is a 2D array of size n x n where n is the number of nodes in a graph.
  • In a 2D array be Adj, a slot Adj = 1 indicates that there is an edge from node i to node j. Adjacency matrix for undirected graph is always symmetric.
  • Adjacency Matrix is also used to represent weighted graphs. If Adj = w, then there is an edge from node i to node j with weight w.
  • Since the size of adjacency matrix is A, therefore the order of the adjacency matrix corresponding to a graph with ‘n’ nodes and ‘m’ edges is n × n.

Related Questions

In which case adjacency list is preferred in front of an adjacency matrix?