Abstract. In this paper, we propose a completely distributed topology generation mechanism named HPC5 for Gnutella network. A Gnutella topology will be efficient and scalable if it generates less number of redundant queries and hence consists of lesser short length cycles. However, eliminating cycles totally, reduces the coverage of the peers in the network. Thus in the tradeoff between the cycle length and network coverage we have found that a minimum cycle length of 5 provides the minumum query redundancy with maximum network coverage. Thus our protocol directs each peer to select neighbors in such a way that any cyclic path present in the overlay network will have a minimum length of 5. We show that our approach can be deployed into the existing Gnutella network without disturbing any of its parameters. Simulation results signify that HPC5 is very effective for Gnutella's dynamic query search over limited flooding.