implements gossip algorithm and push-sum algorithm in SCALA