Chapter 6.  Graph Algorithms

How does immutability affect algorithm design? How are typical algorithms implemented without resorting to in-place mutation?

This chapter will give you a taste of functional algorithms. List prepending will be one dominating theme here. We will start by looking at list reversal and how prepending helps in dealing with algorithms.. We will then look at an efficient algorithm for list reversal using list prepending.

Graphs are a very important data structure; they are used to model related entities. We will be looking at directed graphs, also known as digraphs. We will implement functional versions of common digraph algorithms, for example, traversing a graph and visiting each node to do something useful.

Topological ...

Get Learning Functional Data Structures and Algorithms now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.