Efficient algorithms for the 2-gathering problem

Alon Shalita*, Uri Zwick

*Corresponding author for this work

Research output: Contribution to journalArticlepeer-review


Pebbles are placed on some vertices of a directed graph. Is it possible to move each pebble along at most one edge of the graph so that in the final configuration no pebble is left on its own? We give an O(mn)-time algorithm for solving this problem, which we call the 2-gathering problem, where n is the number of vertices and m is the number of edges of the graph. If such a 2-gathering is not possible, the algorithm finds a solution that minimizes the number of solitary pebbles. The 2-gathering problem forms a nontrivial generalization of the nonbipartite matching problem and it is solved by extending the augmenting paths technique used to solve matching problems.

Original languageEnglish
Article number34
JournalACM Transactions on Algorithms
Issue number2
StatePublished - 1 Mar 2010


  • 2-gatherings
  • Augmenting paths
  • Nonbipartite matchings


Dive into the research topics of 'Efficient algorithms for the 2-gathering problem'. Together they form a unique fingerprint.

Cite this