A visual language for describing systems that have state and change over time.
Every Petri net is built from just three things:
Tokens are the dots inside places. They represent the current state of the system — like game pieces on a board. A transition can only fire (happen) when every input place has at least one token.
When a transition fires:
That's it. This simple rule is enough to model surprisingly complex systems.
Think of it like a board game. Places are the spaces on the board. Tokens are the pieces. Transitions are the moves you can make. The arcs say which spaces connect to which moves.
A traffic light has three states: red, green, and yellow. Only one can be active at a time. Here's how we model it:
The token starts in red. Only the go transition can fire (because red is its input). When it fires, the token moves to green. Now only slow can fire. And so on, forever. This net is:
Flowcharts only show one thing happening at a time. Petri nets can show multiple things happening at once. This is because tokens move independently — you can have many tokens in many places, all at the same time.
Two cooks working in a kitchen simultaneously, sharing the same oven.
Two tokens (cooks) moving independently, both needing a token from the "oven available" place.
This makes Petri nets perfect for modeling:
Every demo on this site, from a coffee shop to a poker hand classifier to predator-prey ecology, is built from the same three elements. The only difference is how you connect them.
The big idea: Simple rules, complex behavior. A few circles, rectangles, and arrows can describe everything from a traffic light to a biochemical reaction.
The Petri Net Viewer lets you browse every model on this site and build your own. Start with the Stoplight (three places, three transitions) and work up to the Tic-Tac-Toe (34 places, 36 transitions).
Open the Petri Net Viewer →