-
Notifications
You must be signed in to change notification settings - Fork 1
/
PagesStatist.h
60 lines (43 loc) · 1.63 KB
/
PagesStatist.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
#ifndef TMK_PAGES_STATIST_H
#define TMK_PAGES_STATIST_H
#include <utility>
#include <vector>
#include <string>
#include "WebCrawler.h"
typedef double PR;
class PagesStatist {
public:
PagesStatist(const char* pagesDataFilePath);
// Get n top pages by PR
void getTopPages(size_t n, std::vector<std::pair<Url, PR> >& oTopPages) const;
// const std::vector<std::pair<PageDetails::PageId, PR> > get
// Get PR
const std::vector<PR>& getPageRank() const;
/*
* Vector with sizes of the pages in bytes
*/
const std::vector<size_t>& getPageSizesInBytes() const;
/*
* Vector with count of outgoing link for pages
*/
const std::vector<size_t>& getPagesOutgoingLinksCount() const;
/*
* Vector with count of incoming link for pages
*/
const std::vector<size_t>& getPagesIncomingLinksCount() const;
const std::string& GetUrlById(PageDetails::PageId id) const;
const std::vector<size_t>& getPageDistancesFromMain() const;
protected:
void calculatePageRank() const;
bool greater(const std::pair<PageDetails::PageId, PR>& a,
const std::pair<PageDetails::PageId, PR>& b) const;
std::vector<Url> urls_;
std::vector<PageDetails> pageDetails_;
mutable std::vector<PR> pageRank_;
mutable std::vector<size_t> pagesSizes_; //sizes in bytes
mutable std::vector<size_t> pagesOutgoingLinksCount_;
mutable std::vector<size_t> pagesIncomingLinksCount_;
mutable std::vector<std::pair<PageDetails::PageId, PR> > idsSortedbByPr_;
mutable std::vector<PageDetails::ClickDistance> pageDistancesFromMain_;
};
#endif // TMK_PAGES_STATIST_H