/**
  * gets the vertices in this cluster
  *
  * @return
  */
 public Collection<String> getVertexIds() {
   ArrayList<String> ids = new ArrayList<String>();
   for (SemiClusteringVertex v : getVertices()) {
     ids.add(v.getVertexID());
   }
   return (Collection) ids;
 }
예제 #2
0
  public void readFields(DataInput in) throws IOException {
    if (in.readBoolean()) {
      this.semiClusterId = in.readUTF();
    }
    this.semiClusterScore = in.readDouble();

    if (in.readBoolean()) {
      int len = in.readInt();
      if (len > 0) {
        for (int i = 0; i < len; i++) {
          SemiClusteringVertex v = new SemiClusteringVertex();
          v.readFields(in);
          semiClusterVertexList.add(v);
        }
      }
    }
    int len = in.readInt();
    if (len > 0) {
      for (int i = 0; i < len; i++) {
        SemiClusterDetails sd = new SemiClusterDetails();
        sd.readFields(in);
        semiClusterContainThis.add(sd);
      }
    }
  }
 public int getInternalWeight() {
   int internalWeight = 0;
   for (SemiClusteringVertex v : getVertices()) {
     for (Edge<IntWritable> e : v.getEdges()) {
       if (getVertexIds().contains(e.getDestinationVertex()))
         internalWeight += e.getEdgeValue().get();
     }
   }
   return internalWeight;
 }