Graph Theory37 sections · 1633 units
Open in Course

Intro

The Goal

In this section, I'll teach you how to measure trees. Not with a tape measure, but by finding the longest path between any two nodes (the diameter), and the most central node (the center). You'll learn two different methods to find diameter: the simple two-BFS approach and the effective DP method.

Both have their uses. By the end, you will solve problems asking for maximum distances, sum of all distances, and tree centers. If you have done the earlier sections on DFS and BFS, this will feel like putting those skills to work.

1769906614383-7ueorf3v0do.jpg