Ejemplo n.º 1
0
  /** <<<<<<< HEAD topK ���ҳ ======= topK 跳出页 >>>>>>> seuvislogwws/master */
  public List<URLNode> topKDropPage(int k) {
    List<URLNode> highdrop_nodes = new ArrayList<URLNode>();
    List<? extends Node> nodes = this.getNodes();
    // ���ҵ����нڵ��indegree����λ��

    double middle = getMiddle(nodes);
    for (Node node : nodes) {
      URLNode n = (URLNode) node;
      if (n.getIn_degree() > middle) {
        if (highdrop_nodes.size() < k) {
          highdrop_nodes.add(n);
        } else {
          URLNode minNode = getMinNode(highdrop_nodes, "drop_percent");
          if (minNode.getDrop_per() < n.getDrop_per()) {
            highdrop_nodes.remove(minNode);
            highdrop_nodes.add(n);
          }
        }
      }
    }
    return highdrop_nodes;
  }
Ejemplo n.º 2
0
 /**
  * <<<<<<< HEAD ȡ��nodes��ij��ָ����С��node ======= 取得nodes中某个指标最小的node >>>>>>> seuvislogwws/master
  *
  * @param nodes
  * @param param
  * @return
  */
 public URLNode getMinNode(List<URLNode> nodes, String param) {
   URLNode node = nodes.get(0);
   for (int i = 1; i < nodes.size(); i++) {
     double quota1 = 0;
     double quota2 = 0;
     if (param.equals("in_degree")) {
       quota1 = node.getIn_degree();
       quota2 = nodes.get(i).getIn_degree();
     }
     if (param.equals("drop_percent")) {
       quota1 = node.getDrop_per();
       quota2 = nodes.get(i).getDrop_per();
     }
     if (quota1 > quota2) node = nodes.get(i);
   }
   return node;
 }