The Maths You Actually NeedLesson 64 of 76

Module 7 · Counting the cost: complexity and the arithmetic of scale

A graph is a matrix, and its paths are its powers

In this lesson

  • 9 min read
  • 8 reading sections
  • Knowledge check
  • Lesson 7 of 9 in this chapter

This chapter’s goalCount the FLOPs of a forward pass and a training run from a parameter count, compute the memory a model needs at each precision and in training, say from arithmetic intensity whether a workload is bound by compute or by memory bandwidth, recognise a quadratic cost in a pipeline and name the sub-quadratic replacement, and estimate the time or cost of an ML job to within a factor of three before running it.

This chapter’s media

The film explains chapter ideas. The audiobook narrates the complete teaching text.

FormatEnglishहिंदी
Chapter filmNot availableNot available
Full audiobookNot availableNot available

A little at a time

Explore an idea, try it, then check what stays.

Step 1 of 9Free · no account needed
Lesson steps

Nodes, edges, and a grid of zeros and ones

A graph is a set of things and a set of connections between them: pages and links, users and follows, papers and citations, atoms and bonds. Write the things down the side and across the top of a grid, put a 1 wherever two are connected and a 0 elsewhere, and you have the adjacency matrix. Everything in module 2 now applies to it.

Four nodes in a square, 1 joined to 2, 2 to 3, 3 to 4, 4 to 1:

Text
      1  2  3  4
  1 [ 0  1  0  1 ]
  2 [ 1  0  1  0 ]
  3 [ 0  1  0  1 ]
  4 [ 1  0  1  0 ]

Your place and first choices stay on this browser. Classroom credit is recorded separately.

Stuck on something?Ask Funke, your AI tutor

How to cite: Addaly (2026) ‘A graph is a matrix, and its paths are its powers’, in The Maths You Actually Need. Edited by M. Mun. Addaly. Available at: https://addaly.com/learn/maths-you-need/graphs-as-matrices (Accessed: 29 November 2026).