Local to global algorithms in gossip based P2P networks
Another solution would be to use SWIM gossip (Scalable Weakly-consistent Infection-style Process Group Membership Protocol), or it derivatives like Serf (which includes the vivaldi network and SWIM) or even Consul (which implements raft consensus, key value store, and Serf).