title: Gossip Algorithm in Java, getting started
body: <p>I want to write a simple implementation of the Gossip Algorithm in Java, but I'm having trouble figuring out where to get started. I'm very new to this kind of network programming and don't know where to get started. The concept is that I want to create a code that will simulate temperature sensors in a building that collects heat in Kelvin. Using gossip algorithm, it will use a push-sum protocol that collects the average of the temperatures in the building using this algorithm:
  si is the inital sum and wi is the inital weight</p>
  
  <p>1: Let {(Sr, Wr)} be all pairs sent to i in round t – 1 (Previous round)</p>
  
  <p>2: Let st, i := ∑〖Sr,   Wt,i〗 = ∑Wr (Sum of all received pairs)</p>
  
  <p>3: Choose a target ft(i) uniformly at random</p>
  
  <p>4: Send the pair (1/2st,I , 1/2wt,I ) to ft(i) and i (yourself)</p>
  
  <p>5: (St,i)/(Wt,i) is the estimate of the average in step t</p>
  
  <p>the algorithm should allow for new sensors to be added without changing any code</p>
  
  <p>I've done a lot of looking up and don't really know how I'll be able to set up this basic communication between the sensors (They all must run the same code). If possible, I would appreciate a point in the right direction on how to set this up properly, a good starting point and I should be able to get the rest of it done myself, thanks!</p>