Strategies

1. Modify a known graph algorithms

2. Use a known graph algorithm as a black box

// In reality we’ll probably do both simultaneously


Examples

Connected components Problem: Given a graph G, how many connected components does G have?

Count map regions

image.png

Solutions

Strategy 2 → Use the “connected components” algorithm as a black box

We need to construct a clever graph – just the right graph

image.png

It will encapsulate or model or represent our input problem in some way.

Finding the Right graph

Could connect based on color OR color and adjacency…but which to pick?

image.png

THE solution