There are lots of topics in both practical and theoretical computer science that deal with graphs, lots of different kinds of graphs, lots of ways to represent a graph as a data structure, and lots of operations you’d want to perform on such a data structure. Like, “is this node in this graph?” or “is there any path from this node to that node in this graph?” and so on. Programming with graphs is a huge topic. In this series I want to explore a tiny subset of those topics. Specifically:
- How can we create an immutable data structure which represents a directed graph with labels on the edges?
- Given a directed acyclic graph (DAG), what are all the possible edge traversals through that graph starting from a particular node?