We propose a probabilistic algorithm for mobile agents which roam around in the network following a random walk. We consider the following problem: when two or more agents meet at a node, they merge into a single agent. As the graph is connected, the agents meet in finite time. We are interested in the time it takes for all agents to merge. More precisely, we study a probabilistic model and we analyse the time complexity of a distributed algorithm for all the agents to merge into a single one.