TL;DR
A group of agents each holds a number, such as a heading, a height or a temperature reading. Each agent can only talk to its neighbours in a communication graph. Consensus is a simple local rule: every agent nudges its value toward the values of the neighbours it can hear. If the graph is connected, all values converge to one common number, and with the simplest rule that number is the average of the starting values.
The speed of convergence is set by the graph itself. It is read from the eigenvalues of the graph Laplacian, and the second-smallest one tells you how quickly the group agrees.
Where you'll see it: in flocking and formation control, where a swarm of drones aligns its headings without a leader, in distributed sensor networks that average their readings, and in distributed optimization, where machines agree on a shared estimate.
Intuition
Agreeing by talking to neighbours
Picture five people standing in a line, each holding a card with a number on it. Nobody can see the whole room. Each person can only hear the two people beside them. The group wants everyone to end up holding the same number, but there is no chair in charge of collecting the cards.
The rule is simple. Each person looks at the neighbours' numbers, and moves their own number a little toward them. If your number is higher than your neighbour's, you lower yours; if it is lower, you raise yours. Repeat this for everyone at once, and the differences between neighbours shrink. Keep going and the whole line flattens to one value.
This is the core idea of consensus. No agent knows the global state. Each agent uses only local information, and agreement emerges from the repeated local moves.
flowchart LR A1((agent 1)) --- A2((agent 2)) A2 --- A3((agent 3)) A3 --- A4((agent 4)) A4 --- A5((agent 5))
Why this model exists: real multi-agent systems rarely have a central computer. A robot swarm, a set of wireless sensors or a fleet of satellites has to coordinate over links that are local, slow and sometimes broken. Consensus gives a way to reach a shared value, with no leader and no full picture, using only messages between neighbours.
The math
Setup
Let there be agents, and let agent hold a scalar state at time . Stack the states into one vector . The agents communicate over an undirected graph with adjacency matrix , where if agents and can hear each other and otherwise. Let be the diagonal degree matrix, with on its diagonal, and let be the graph Laplacian.
The continuous-time consensus protocol is
Each agent's rate of change is the sum of its disagreements with its neighbours, so it moves toward them. This is a linear dynamical system with dynamics matrix and no input or noise, so its solution is .
Two facts about the Laplacian
Two properties of do all the work. Both follow from the definition .
- Every row sums to zero. So , where is the all-ones vector. This means the constant vector is an eigenvector with eigenvalue zero.
- is symmetric and positive semidefinite. Its eigenvalues are real and non-negative, and they can be ordered as .
The number is called the algebraic connectivity, or the Fiedler value. It is positive exactly when the graph is connected.
The average is preserved
Because the columns of also sum to zero, . Differentiate the average :
So the average of the states never changes. Whatever the group agrees on, it has to be the initial average.
Convergence
Let be the eigen-decomposition, with orthonormal eigenvectors . Then
Each mode decays at rate . The mode with does not decay, and it is the average direction . Every other mode decays to zero if . So for a connected graph,
The slowest mode is the one with the smallest positive eigenvalue, . A sparse graph has a small and slow agreement. A well-connected graph has a large and fast agreement.
Discrete-time version
Real networks often update at discrete times. The rule becomes for a step size . Choosing , where is the largest degree, keeps every entry of non-negative, so each agent's new value is a weighted average of its own value and its neighbours' values. The average is still preserved, because .
Worked examples
Take three agents in a path, . Agent 2 talks to both others, and agents 1 and 3 talk only to agent 2. The adjacency and degree matrices are
- The eigenvectors are with eigenvalue , with eigenvalue , and with eigenvalue . Check the middle one: , so its eigenvalue is .
- Start from . Its average is . Write . Check: .
- Apply the solution formula. The constant part stays. The part decays at rate . So .
- Read off each agent: , , .
- Check the dynamics for agent 1: , and . They agree.
Numbers: at , and . At , and . The gap between the outer agents shrinks by the factor per unit time, and the rate is exactly .
Interpretation: the middle agent never moves because it already sits at the average. The ends move inward at the rate the graph allows, and everything lands on , the starting average.
- agent 1
- agent 2
- agent 3
Use the same path graph and start from . Here , so choose , which is below .
- Compute the Laplacian action: .
- Update: .
- Check the average: . It is unchanged, as the theory says.
- Repeat. , so .
Interpretation: each step pulls the outer agents inward by a third of the disagreement with their neighbours. The spread shrinks from to to about , and the average stays at . Each new value is a weighted average of the agent's own value and its neighbours', so the states never leave the range of the starting values.
Take four agents with only two links, and . This graph has two components. Its Laplacian has eigenvalues , so . Start from .
- The first component, agents 1 and 2, has average . Within it, both agents move to .
- The second component, agents 3 and 4, has average , and both move to .
- The limit is . No single value is reached.
Interpretation: consensus needs a connected graph. With two components, each group agrees internally and the groups never talk, so the global average is not the target. The condition tells you this in advance.
Tradeoffs and failure modes
The linear averaging protocol is simple and robust, but it has limits.
| Situation | What goes wrong | Better choice |
|---|---|---|
| The communication graph is sparse, such as a long chain | is small, so agreement is slow | Denser links, or a graph with better connectivity |
| The graph is disconnected, or links drop often | The group splits into groups that never agree globally | Ensure connectivity over time, or add relays |
| Messages arrive late | Delayed information can make the protocol oscillate or diverge if the step size is too large | Smaller step size, or delay-aware protocols |
| The agents need the exact average, not just agreement | On an undirected graph the protocol gives the exact average, but on a directed graph, or with unbalanced weights, it converges to a weighted average of the starting values | Use symmetric weights, or add a correction step such as push-sum |
| Agents are heterogeneous, or the network is adversarial | A single faulty or malicious agent can pull the group to a wrong value | Byzantine-tolerant consensus, which needs many more messages |
A common mistake is to assume that more links always help. They do speed up agreement, but a poorly designed update rule can still diverge if the step size is too large. Check the step-size bound before running a discrete system.
History
The idea of agents converging to a common opinion by repeatedly averaging their neighbours' views goes back to the statistician Morris DeGroot, who described it in a 1974 paper on reaching consensus among experts. The same averaging update reappeared in control and computer science, where it is now studied as a special case of linear dynamics on graphs.
In the 1980s, researchers in distributed computing and optimization, including John Tsitsiklis and his collaborators, analysed agreement and averaging protocols for networks of processors. Their work showed how convergence depends on the network's connectivity. The graph Laplacian came to be the central object in the mid-1990s and early 2000s, when work on flocking and swarms, notably the Vicsek model of 1995, made coordination of moving agents a research topic. Reza Olfati-Saber and Richard Murray's 2004 paper set out the Laplacian-based consensus framework for switching and delayed networks, and their 2007 survey became a standard reference.
Check yourself
QuestionWhy does the average of the agents' states stay fixed under the consensus rule?Show answer
Every column of the Laplacian sums to zero, so the vector of ones multiplied by is zero. The time derivative of the average is therefore , which is zero. The protocol moves values around but never changes their total, so the group can only agree on the starting average.
QuestionFor a connected path of four agents, what is the consensus value if the starting states are ?Show answer
The average is . Because the average is preserved and a connected graph converges to a common value, the group converges to .
QuestionWhy does the second-smallest Laplacian eigenvalue, not the largest, set the speed of agreement?Show answer
Every mode of the state except the average decays at a rate equal to its eigenvalue. The slowest of these decaying modes has the smallest positive eigenvalue, , so the gap between agents shrinks no faster than . The largest eigenvalue describes the fastest mode, which is already gone by the time the slow one matters.
QuestionA swarm of drones can only hear neighbours within a fixed radius. What would you check before expecting the swarm to agree on one heading?Show answer
Check that the communication graph is connected, meaning there is a path of hearing links between any two drones, or that it stays connected over time as drones move. If the graph splits into groups, each group agrees on its own heading and the groups never coincide. Also check that the update step is small enough for the largest number of neighbours any drone has, so the protocol does not oscillate.