Clustering as a means of leader selection in consensus networks

In the leader-follower approach, one or more agents are selected as leaders who do not change their states or have autonomous dynamics and can influence other agents, while the other agents, called followers, perform a simple protocol based on the states of their neighbors. This approach provides a natural link between control theory and networked agents with their input data. Despite the fact that the leader-follower approach is widely used, the fundamental question still remains: how to choose leaders from a set of agent. This question is called the problem of choosing leaders. There is still no selection algorithm that is both optimal under a natural criterion and fast. In this paper, for agents that obey a linear consensus protocol, we propose to choose leaders using graph nodes' clustering algorithms and show that this method is the most accurate among the fast existing algorithms of choosing leaders.



There are no comments yet.


page 4


Logarithmic Expected-Time Leader Election in Population Protocol Model

In this paper, the leader election problem in the population protocol mo...

Fast Approximate Counting and Leader Election in Populations

We study the problems of leader election and population size counting fo...

Almost logarithmic-time space optimal leader election in population protocols

The model of population protocols refers to a large collection of simple...

Data Clustering as an Emergent Consensus of Autonomous Agents

We present a data segmentation method based on a first-order density-ind...

Structurally Observable Distributed Networks of Agents under Cost and Robustness Constraints

In many problems, agents cooperate locally so that a leader or fusion ce...

Event-Triggered Algorithms for Leader-Follower Consensus of Networked Euler-Lagrange Agents

This paper proposes three different distributed event-triggered control ...

Fast Flexible Paxos: Relaxing Quorum Intersection for Fast Paxos

Paxos, the de facto standard approach to solving distributed consensus, ...
This week in AI

Get the week's most popular data science and artificial intelligence research sent straight to your inbox every Saturday.

I Introduction

A multi-agent system is a system formed by a number of interacting agents. Multi-agent systems can be used to solve problems that are difficult or impossible to solve with a single agent or a monolithic system. Examples of such tasks are emergency response [1], modeling of social structures [2], and many others.

Movement of several agents to a given control point while maintaining a relationship between their states is an important problem in robotics. For example, in applications, including spaceships, unmanned aerial vehicles (UAVs), and mobile robots, agents often need to move to a landmark or target point while maintaining the shape of their formation.

The leader-follower approach is one of the ways to solve this type of formation control problems [3].

Recently, several methods of solving the problems of choosing leaders in networked multi-agent systems have been studied, in particular, within the framework of linear consensus protocols. Some graph indices, such as node degree, have been tested in terms of leader performance [4]. The problem of choosing leaders can be solved either ascendingly (choosing one leader and adding other leaders until the set of leaders becomes optimal) [5], or descendingly: the optimal set of leaders is sought by excluding agents from the entire set of agents [6]. To control UAVs, an “online” leader change was applied in order to improve the rate of convergence of agents’ positions [7].

The task of selecting leaders from the set of agents is similar to a node clustering task in a graph if each leader is treated as an agent responsible for its own cluster [8]

. Therefore, it is reasonable to compare existing leader selection algorithms with clustering methods combined with choosing the “main” node in each cluster. The most popular clustering methods are spectral clustering based on optimization of graph slices

[9] and the -means method, which seeks to minimize the total quadratic deviation of cluster points from the centers of these clusters [10].

In this paper, we consider the problem of choosing leaders in the case where they preserve their initial states, i.e., they are static. The problem of selecting mobile leaders was considered, for example, in [11].

The work consists of two main parts. The first one is a simulation in ideal conditions and the second one is a simulation in real conditions using a model of e-puck2 mobile robots [12]. “Real conditions” means a system with some restrictions, for example, with a limited possible speed of the robots.

The aim of the paper is to compare existing algorithms for choosing leaders with the method based on graph nodes’ clustering with respect to accuracy and convergence time in ideal and real conditions.

Ii Model

We will consider a multi-agent system with a corresponding connection graph . The graph is directed and represents the system structure. We will identify the node , , with the -th agent. Agent depends on agent if there is a directed edge . Each edge has its weight , thereby we have a weighted adjacency matrix of the system [13].

Let matrix be the Laplacian matrix [14] of the graph with adjacency matrix . Each agent has its state . In this paper, denotes agent’s coordinate. The linear consensus protocol has the form



is the state vector of the system.

Leaders represent stubborn agents: they get their states initially, and these states do not change over time. Respectively, we will divide the general state of the system into the state of leaders and the state of followers: where is the state of followers and is the state of leaders. Thus, the linear consensus protocol (1) can be rewritten in the following way:


Leaders preserve their states, hence, and are zero, so that is zero and is constant. Then, is the grounded Laplacian of the system [15]. In this paper,

is assumed to be symmetric. Thus, the followers influence each other equally. The convergence rate of the system can be asymptotically measured by the smallest eigenvalue of the grounded Laplacian

[5], therefore, further in the paper we will identify these quantities.

Next, for simulation purposes, we define convergence time as follows:

Definition 1.

Let be a limit state of the system. The system reaches with fixed error in convergence time , if


where is the Euclidean norm of vector .

Iii Algorithms

We will compare six algorithms, also we will study the algorithmic complexity of them, after that we will consider two additional algorithms presented in [16, 17]. The algorithm in [16] is based on theoretical calculations, so it is optimal, however its algorithmic complexity is higher than that of the best realization of the greedy algorithm in [17], whose complexity in turn is higher than that of the k-means algorithm.

These six algorithms are:

  1. Choose k-leader algorithm. A pseudocode description of Choose k-leader algorithm is given in [5]. Its algorithmic complexity is between and due to the need to calculate the eigenvalues of the Laplacian matrix and then choose the smallest eigenvalue times.

  2. Random leader selection. k

    numbers are randomly selected without repetitions using uniform distribution from

    to ; the corresponding agents are chosen as leaders. The algorithmic complexity is .

  3. Leaders with max degree. k nodes with maximum indegrees are chosen from the connection graph. The algorithmic complexity is , because we need to calculate the degree of each node.

  4. Leaders with average degree. k nodes with average indegrees are chosen from the connection graph. The algorithmic complexity is as well.

  5. k-means algorithm. The connection graph is split into k clusters with -means algorithm. Then, the closest node to the center of the cluster is chosen as the leader of this cluster. If this node is already chosen as leader for another cluster, then the second closest node is selected and so on. The -means clustering is taken from Python library sklearn with default parameters; its average algorithmic complexity is , the worst complexity is [18]. However, the worst complexity is not reached because of the fixed maximum number of iterations.

  6. Huge random selection. Firstly, 10000 numbers from 1 to are uniformly chosen and each number is an index in an imaginary list in which all possible selections of leaders are arranged in lexicographic order; knowing the index, a selection can be made. Thus, 10000 selections are chosen. The algorithm iterates over all selected sets of leaders and finds the set with the maximum smallest eigenvalues of the corresponding grounded Laplacian . If the number of different selections is not uniformly limited, then the algorithm has combinatorial complexity. Therefore, the upper bound of 10000 was taken in order to reduce the execution time to a reasonable one. Obviously, the algorithm does not guarantee the best result, but as we will see in the experiments, its results are better than those of the previous algorithms.

As for the remaining two algorithms, greedy algorithm in [17] with the best realization has an algorithmic complexity of and the complexity without these improvements in realization is . The exact algorithm in [16] for the -leader selection problem has a polynomial algorithmic complexity of in the case of path or ring graphs taken.

Thus, it can be seen that the k-means algorithm has the smallest average asymptotic complexity among non-random algorithms.

Iv Simulation

Consider a multi-agent system containing 100 agents uniformly distributed in a m square. Let two agents-followers be symmetrically connected if and only if the initial distance between them is no more than m. The weights of these connections are chosen uniformly from the interval (0, 50]. The weighted adjacency matrix generated in this way does not change later.

In all experiments, we measured the convergence time (see Definition 1). Since agents had and coordinates, the total deviations along both axes from the limiting state were calculated, and when both of these deviations do not exceed the fixed error, we admit that the system reached the limit. Based on the obtained convergence times, we conclude that one algorithm is better than another. Additionly, we measure the convergence rates for all algorithms, which are identified with the smallest eigenvalues of the corresponding grounded Laplacian matrices ; the results are provided below.

Each experiment was repeated 30 to 100 times depending on the number of leaders (from to ); the obtained convergence time was averaged for each .

To bring the system closer to reality, physical limitations were imposed: these were the limits on the maximum speed. Simulation was performed in Webots, an open source robot simulator, which contains various robot models, including a model of e-puck2 robots. The e-puck2 model was used for simulation with physical constraints that the maximum speed is limited to


Experiments with physical limitations were carried out in Webots on C language, without these restrictions on Python. More details about the experiments carried out can be found in the Appendix.

Iv-a Experiments’ settings

For all experiments, the convergence error (see Definition 1) was set to be cm. This error was chosen experimentally, as it allows to achieve fairly accurate results within a reasonable time.

The number of leaders ranged from to , but the charts show values only from to , since the results for larger numbers of leaders are similar. Convergence time slowly discreases and convergence rate slowly increases in the number of leaders for all dependencies.

The simulation time step for both experiments with physical limitations and without them was equal to 1 ms, which is the minimum available time step in Webots.

Iv-B Convergence time of the algorithms

In this section, we present the results on the convergence time depending on the number of leaders either with constraints on speed or without them.

First, we compare algorithms 1 to 5 because their complexities are much smaller than the complexity of huge random selection algorithm that is defined by constant number 10000. As Fig. 1 shows, k-means algorithm gives the best result and random leader selection, choose k-leader algorithm, and leaders with average degree give approximately similar results. Finally, leaders with max degree gives the worst result in the experiments with physical restrictions. However, the algorithm shows good results with a small number of leaders in the experiment without physical restrictions. These results should be investigated separately. Note that the difference between the algorithms is clearly seen in the experiments with physical limitations, however the convergence rate, which in this study is identified with the smallest eigenvalue of the grounded Laplacian, is the same in both experiments, therefore the convergence rate should not be the only decisive factor when choosing an algorithm.

Also the convergence time of experiments with physical limitations (see Fig. 0(b)) does not smoothly decrease with increasing number of leaders; this may indicate that more averaging is needed.

Fig. 1: Comparison of k-means with four other algorithms. (a) Experiments without physical limitations. (b) Experiments with physical limitations on speed.

Second, we compare k-means, choose k-leader and random leader selection algorithms with huge random selection. We selected these algorithms because they gave the best or approximately similar results in the previous experiments and we do not compare all the algorithms so as not to clutter up the charts. As we can see in Fig. 1(a), huge random selection gives the best convergence rate and k-means’ result is quite close to it. Also we can see from the simulation that these two algorithms give the best results concerning the convergence time, though k-means algorithm is better in the experiments with physical restrictions. This is apparently related to the stop simulation criterion which depends on the convergence error (see Definition 1).

Fig. 2: Comparison of huge random selection with three previous algorithms. (a) Convergence rates in the experiments. (b) Time in the experiment without physical limitations. (c) Time in the experiment with physical limitations on speed.

Finally, let us look at the scatter of the received data, which will give an understanding of the stability of the algorithm for real use. On Fig. 3, the difference between the maximum and the minimum convergence time is plotted along the time axis. It can be seen that the ranges of time for k-means and huge random selection algorithms are much smaller than those of choose k-leader and random leader selection algorithms; for the remaining algorithms the range is quite similar to the last two.

Fig. 3: Scatter of convergence time. (a) The experiment without physical limitations. (b) The experiment with physical limitations

V Conclusion

In this paper, we compared several algorithms for solving the leader selection problem with regard to the leader-follower consensus protocol for both systems with physical constraints and idealized ones. The following algorithms were compared:

  • The -leader selection algorithm [5],

  • the random choice,

  • the choice of agents with the maximum indegrees in the agents’ dependency graph,

  • the choice of the agents with average indegrees in the agents’ dependency graph,

  • the -means algorithm, with the subsequent selection of nodes that are closest to the center of each cluster.

Additionally, all algorithms were compared with huge random selection algorithm. It turned out that the clustering algorithm showed the best results in all experiments, except for huge random selection algorithm whose algorithmic complexity is determined by the upper bound on the number of different selections, without this bound, the complexity is combinatorial.

In future work, it would be interesting to apply other clustering algorithms, as well as an alternative version of -means algorithm, where the leader in each cluster is chosen as the node with the maximum degree in the cluster.

In preliminary experiments, we observed that the agglomerative clustering algorithm gave similar results to those of the -means algorithm, though the algorithm complexity of the agglomerative clustering is higher than the complexity of the -means algorithm [19]. Thus, the main conclusion is that clustering algorithms are useful in solving the leader selection problem. However, we also tested the spectral clustering algorithm [20] and it gave results much worse than those of leaders with max degree algorithm.

In this work, we did not consider systems with mobile leaders or dynamic connections, systems with acceleration, or systems with shape preserving. The problems of leader selection for them are in many respects similar to the simplest problems studied in this paper, however, of course, they are more complicated both theoretically and experimentally. In a further development of this work, such problems can be analyzed by applying clustering algorithms.


Simulation on Python and Webots consisted of 5 main steps:

  1. Generation of coordinates;

  2. Generation of the adjacency matrix based on these coordinates and the connection condition;

  3. Generation of the Laplacian matrix;

  4. A transformation of this Laplacian matrix according to the type of an algorithm (see Section III);

  5. Run of the simulation.

The first four steps were the same for both types of the experiments and were implemented on Python.

After the generation of the coordinates and the Laplacian matrix the simulation started in a huge cycle, which can contain a maximum of iterations; in our experiments, .

Firstly the final limit state was calculated simply as , so if the system did not reach this limit state in steps or less, new coordinates and the corresponding Laplacian matrix were generated and simulation started again.

Experiments without physical limitations

On each step of the simulation on Python, agents’ coordinates were updated as:

where is a simulation time step and equals to 1 ms in our experiments. After this update, the distance between the current state and the limit state was calculated according to Definition 1 and compared with the fixed error. If this distance was less than the fixed error, the simulation stoped, otherwise the new iteration began.

Experiments with physical limitations

Simulation on Webots was similar to the one on Python with the difference that before the each simulation step , agents updated their new speeds as with 15.4 cm/s being the maximum speed. Webots updates the speed with the last speed, acceleration and motor torque taken into account. After a simulation time step, a predeterminated agent (“inspector”) obtained the other agents’ coordinates, calculated the distance from the limit state, compared it with the fixed error and decided if simulation required continuation. If so, the inspector recalculated the speeds of all agents, sent them back, and simulation step repeated again.

Due to the way of the simulation and the implementation, no time was wasted on exchanging information, this time must be taken into account when implementing the algorithm on real robots.


  • [1] Schurr, N., Marecki, J., Tambe, M., Scerri, P., Kasinadhuni, N., & Lewis, J. P. “The future of disaster response: humans working with multiagent teams using DEFACTO.” AAAI Spring Symposium: AI Technologies for Homeland Security, pp. 9-16, 2005.
  • [2] Sun, R., & Naveh, I. “Simulating organizational decision-making using a cognitively realistic agent model.” Journal of Artificial Societies and Social Simulation 7(3), 2004.
  • [3] Mesbahi, M., & Egerstedt, M. “Graph Theoretic Methods in Multiagent Networks.” Princeton University Press, 2010.
  • [4] Borsche, T., & Attia, S. A. “On leader selection in multi-agent control systems.” In 2010 Chinese Control and Decision Conference, pp. 102-107, IEEE, 2010.
  • [5] Clark, A., Alomair, B., Bushnell, L., & Poovendran, R. “Leader selection in multi-agent systems for smooth convergence via fast mixing.” In Proceedings of the 51st IEEE Conference on Decision and Control, pp. 818–824, 2012.
  • [6] Sato, K. “Optimal leader selection and demotion in leader-follower multi-agent systems.” arXiv preprint arXiv:1802.06479, 2018.
  • [7] Franchi, A., Bülthoff, H. H., & Giordano, P. R. “Distributed online leader selection in the bilateral teleoperation of multiple UAVs.” In 2011 50th IEEE Conference on Decision and Control and European Control Conference, pp. 3559-3565, IEEE, 2011.
  • [8] Shah, D., & Zaman, T. “Community detection in networks: The leader-follower algorithm.” In Proc. of Workshop on Networks Across Disciplines: Theory and Applications, pp. 1–8, 2010.
  • [9] Meila, M., & Shi, J. “Learning segmentation by random walks.” In Advances in Neural Information Processing Systems, pp. 873-879, MIT Press., 2001.
  • [10]

    Gorban, A.N., & Zinovyev, A.Y. “Principal graphs and manifolds.” In Handbook of Research on Machine Learning Applications and Trends: Algorithms, Methods and Techniques, pp. 28-60, 2009.

  • [11] Lin, F., Fardad, M., & Jovanovic, M. R.,“Algorithms for leader selection in stochastically forced consensus networks,” IEEE Trans. Automat. Control, 59(7), pp. 1789–1802, 2014.
  • [12] GCTronik, e-puck2. [Online]. Available:, 2018
  • [13] Horn, R. A., & Johnson, C. R. “Matrix Analysis.” Cambridge University Press, 2012.
  • [14] Chebotarev, P., Agaev, R. “Forest matrices around the Laplacian matrix,” Linear Algebra and Its Applications, 356, pp. 253-274, 2002.
  • [15] Barooah, P., & Hespanha, J. P. “Graph effective resistance and distributed control: Spectral properties and applications.” In 45th IEEE Conference on Decision and Control, pp. 3479–3485, 2006.
  • [16] Patterson, S., McGlohon, N., & Dyagilev, K. “Optimal k-leader selection for coherence and convergence rate in one-dimensional networks.” IEEE Trans. Control Netw. Syst., 4(3), pp. 523-532, 2016.
  • [17] Wang, Y., Yang, W., & Wang, X. “Optimal leader selection for fast consensus via consensus centrality.” In Proceedings of the 33rd Chinese Control Conference, pp. 1482–1487, IEEE, 2014.
  • [18] Pedregosa et al., “Scikit-learn: machine learning in python,” JMLR 12, pp. 2825-2830, 2011.
  • [19] Rokach, L., & Maimon, O.“Clustering methods.” In Data Mining and Knowledge Discovery Handbook, pp. 321-352. Springer, Boston, MA, 2005.
  • [20]

    Ng, A. Y., Jordan, M. I., & Weiss, Y. “On spectral clustering: Analysis and an algorithm.” In Advances in Neural Information Processing Systems, pp. 849-856, 2002.