Beginner’s Guide to LangGraph: Understanding State, Nodes, and Edges — Part 1

Kamal Dhungana
5 min readJul 27, 2024

LangGraph — State, Node and Edge Explained

Image created by the author using ChatGPT-4

In this article, we will discuss the basics of LangGraph. Mainly, we will focus on various components of LangGraph: State, Node, and Edges, and how to build a complete graph from these components. Once we understand these components, we will be able to build relatively complex LangGraph-based agents.

The Comprehensive LangGraph Guide is available here.

All the sample codes associated with this article are available in this notebook.

Find part 2 here. Part 2 is about Tools, Router, and Branch.

First, let’s understand the various components, and then use them to construct a complete graph.

A Simple Graph

Nodes: Nodes are the fundamental building blocks of a graph. Each node represents a specific function or operation that processes the current state. Nodes can perform computations, modify the state, or generate outputs based on the input they receive. They are typically defined as Python functions or classes that take the current state as input and return an updated state.

--

--

Kamal Dhungana
Kamal Dhungana

Written by Kamal Dhungana

Data scientist with a passion for AI, Regularly blogging about LLM and OpenAI's innovations,Sharing insights for AI community growth

Responses (1)