14. Graphs

In This Chapter

Introduction to Graphs

Traversal and Search

Minimum Spanning Trees

Topological Sorting

Connectivity in Directed Graphs

Graphs are among the most versatile structures used in computer programming. They appear in all kinds of problems that are generally quite different from those we’ve dealt with thus far in this book. If you’re dealing with general kinds of data storage problems such as records in a database, you probably don’t need a graph, but for some problems—and they tend to be interesting ones—a graph is indispensable.

Our discussion of graphs is divided into two chapters. In this chapter we cover the algorithms associated with unweighted graphs, show some problems that these graphs can represent, and ...

Get Data Structures & Algorithms in Python now with the O’Reilly learning platform.

O’Reilly members experience live online training, plus books, videos, and digital content from nearly 200 publishers.