code: public int[] labelPropagation() {
          int[] labels = new int[nodeCount];
          for (int nodeId = 0; nodeId < nodeCount; nodeId++) labels[nodeId] = nodeId;
  
          boolean[] done = {false};
          while (!done[0]) {
              done[0] = true;
              runProgram((start, end) -> {
                  if (labels[start] != labels[end]) {
                      done[0] = false;
                      labels[start] = labels[end] = Math.min(labels[start],labels[end]);
                  }
              });
          }
          return labels;
      }
docs: /*
  fn label_propagation<G: EdgeMapper>(graph: &G, nodes: u32) {
  let mut label: Vec<u32> = (0..nodes).collect();
  let mut done = false;
  while !done {
  done = true;
  graph.map_edges(|x, y| {
  if label[x] != label[y] {
  done = false;
  label[x] = min(label[x], label[y]);
  label[y] = min(label[x], label[y]);
  }
  });
  }
  }