AI engineering glossary · Data structures algorithms

What is adjacency matrix?

Adjacency matrix: A way of storing a graph as an n by n table where the entry in row i, column j shows whether an edge connects vertex i to vertex j. Edge checks take one step, but the table needs n^2 space regardless of edge count.

Level: intermediateTopic: Data structures algorithms

Adjacency matrix: an example

For 1,000 vertices the matrix has 1,000,000 cells. It suits dense graphs where most pairs are connected.

Related terms

More Data structures algorithms terms

Where you learn it

Adjacency matrix is part of the AI Engineering Program, which teaches it with notes, a hands-on lab and an exam. The first lesson is free.

Before you go

Take the cheat sheet with you

One free PDF: the key AI-engineering terms, formulas and Python idioms. No spam; unsubscribe any time.