コード例 #1
0
 public AHPageLoader(int[] resultDocs, int rootSize, int maxParents, int maxChildren)
 {
     index     = new LinkIndex();
     pageGraph = new AHPageGraph(rootSize);
     loadBaseSet(resultDocs, rootSize, maxParents, maxChildren);
     loadLinks();
 }
コード例 #2
0
ファイル: PageRankCalculator.cs プロジェクト: ic4f/oldcode
        private void init()
        {
            DataTable docIds   = new d.DocData().GetIds();
            int       doccount = docIds.Rows.Count;
            float     initRank = 1f / doccount;
            LinkIndex index    = new LinkIndex();

            inboundLinks = new Hashtable();
            ranks        = new float[doccount];
            ids          = new int[doccount];

            int i = 0;
            int docid;

            int[] inboundArray;
            foreach (DataRow dr in docIds.Rows)
            {
                docid = Convert.ToInt32(dr[0]);

                ranks[i] = initRank;                    //load initial pagerank value
                ids[i]   = docid;                       //load docid into position i
                i++;

                Hashtable currInbounds = new Hashtable();                       //make hashtable for current docid
                inboundLinks.Add(docid, currInbounds);                          //store this hashtable of inboundlinks for current docid
                inboundArray = index.GetInboundLinks(docid);                    //get inbound links array for current docid
                foreach (int fromid in inboundArray)                            //store it in this hashtable
                {
                    currInbounds.Add(fromid, true);
                }
            }

            outboundLinkCouns = new Hashtable();
            DataTable linkCounts = new d.DocData().GetLinkCounts();
            int       countTo;

            foreach (DataRow dr in linkCounts.Rows)
            {
                docid   = Convert.ToInt32(dr[0]);
                countTo = Convert.ToInt32(dr[2]);
                outboundLinkCouns.Add(docid, countTo);
            }
        }