We model situations in which a principal provides incentives to a groupof agents to participate in a project (such as a social event, commercialactivity or the adoption of a certain technological standartization).Agents' benefits from participation depend on the identity of otherparticipating agents. We assume bilateral externalities and characterize theoptimal incentive mechanism. Using a graph-theoretic approach we show thatthe optimal mechanism provides a ranking of incentives for the agents, whichcan be described as arising from a virtual popularity tournament among theagents (similar to ones carried out by sport associations). Rather than simplyranking agents according to their measure of popularity, the optimal mechanism makes use of more refined two-way comparison between the agents. Animplication of our analysis is that higher levels of asymmetry of externalitiesbetween the agents enable a reduction of the principal's payment. In addition, contrary to intuition, an increase in the aggregate externalities, does notnecessarily decrease principal's payment, nor does it change agents rewards.