Skip to content
AI360Xpert
Glossary
Definition

Adjacency Matrix

A square grid recording which pairs of nodes in a graph are connected, with one row and one column per node.

Cell (i,j)(i, j) holds 1 when an edge runs from node ii to node jj, or the edge's weight when there is one. For an undirected graph it's symmetric, so every edge appears twice — which makes each row's sum that node's degree, a genuinely useful identity.

Its cost is the square of the node count. A million nodes is 101210^{12} cells, so a terabyte even at one byte each, and dense storage stops being possible somewhere in the tens of thousands of nodes.

Which is why real graphs are stored as an edge list — two columns, memory linear in edges — or as a CSR-style neighbour index, which keeps linear memory and still answers "who are node ii's neighbours" in constant time. The same graph at a million nodes and ten million edges is a terabyte one way and 160MB the other.