private static void printtopK(AutoMap<String, Double> mSeeds, AutoMap<String, Double> mNoise) { int topKSeeds = 100; int topKNoise = 100; System.out.println("Top " + topKSeeds + " seeds... "); TreeMap<String, Double> sortedMSeeds = mSeeds.sortByValue(); for (Entry<String, Double> e : sortedMSeeds.entrySet()) { if (topKSeeds-- < 0) break; System.out.println(topKSeeds + ". " + e.getKey()); } System.out.println("Top " + topKNoise + " noise seeds... "); TreeMap<String, Double> sortedMNoise = mNoise.sortByValue(); for (Entry<String, Double> e : sortedMNoise.entrySet()) { if (topKNoise-- < 0) break; System.out.println(topKNoise + ". " + e.getKey()); } }
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); }