Core concepts of graph theory
To better understand how we are going to use LangGraph in the next few blocks of code, it is helpful to review some key concepts in graph theory. Graphs are mathematical structures that can be used to represent relationships between different objects. The objects are called nodes and the relationships between them, typically drawn with a line, are called edges. You have already seen these concepts in Figure 12.1, but it is important to understand how they relate to any graph and how that is used in LangGraph.
With LangGraph, there are also specific types of edges representing different types of these relationships. The “conditional edge” that we mentioned along with Figure 12.1, for example, represents when you need to make a decision about which node you should go to next; so, they represent the decisions. When talking about the ReAct paradigm, this has also been called the action edge, as it is where the action takes place, relating...