Example #1
0
  public static void main(String[] args) throws IOException {
    SeedSelectionvers_1 st = new SeedSelectionvers_1();
    st.fileinputread();
    st.clutoinput();

    /** ***************arraylist of adjacency vertices*********************************** */
    String strneig = "";
    String line3 = "";
    BufferedReader brneighb = new BufferedReader(new FileReader("./seeddata/bigFileChuncks5k.mat"));
    strneig = brneighb.readLine();
    for (int i = 0; i < 1299; i++) {
      strneig = brneighb.readLine();
      st.initadj(i, strneig);
    }

    /** ************arraylist of vertex and cluster using solution.sol***************** */
    String strread = "";
    String line1 = "";
    String strclust = "";
    String line2 = "";
    arr = new ArrayList<String>();
    BufferedReader brclust = new BufferedReader(new FileReader("./seeddata/solution.sol"));
    BufferedReader brrow =
        new BufferedReader(new FileReader("./seeddata/bigFileChuncksrow5k.mat.rlabel"));
    boolean flag2 = true;
    while ((strread = brclust.readLine()) != null) {
      if (strread.length() == 0) flag2 = false;
      else line1 = line1 + strread + "\n";
    }

    while ((strclust = brrow.readLine()) != null) {
      arr.add(strclust);
    }
    String[] clustn = line1.split("\n");
    vertdetails = (ArrayList<String>[]) new ArrayList[1299];
    for (int v = 0; v < arr.size(); v++) {
      vertdetails[v] = new ArrayList<String>();
    }

    for (int i = 0; i < arr.size(); i++) {
      String vertex = arr.get(i);

      String clust = clustn[i];

      vertdetails[i].add(vertex);
      vertdetails[i].add(clust);
    }
    /** ******************************************************** */
    topK(st);
  }
Example #2
0
  public static void topK(SeedSelectionvers_1 st) {

    AutoMap<String, Double> mSeeds = new AutoMap<>();
    AutoMap<String, Double> mNoise = new AutoMap<>();
    System.out.println(arr);

    for (int i = 0; i < arr.size(); i++) {
      double pd1, pd2, pd3;
      String vertex = arr.get(i);
      pd2 = sigmoid(st.distinterdegreeofvertex(i));
      pd3 = sigmoid(st.intradegreeofvertex(i) / (1 + st.distinterdegreeofvertex(i)));

      mSeeds.put(vertex, pd3);
      mNoise.put(vertex, pd2);
    }

    printtopK(mSeeds, mNoise);
  }