-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathPageRankAlgorithmInterface.php
59 lines (52 loc) · 1.98 KB
/
PageRankAlgorithmInterface.php
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
<?php
declare(strict_types=1);
namespace PhpScience\PageRank\Service;
use PhpScience\PageRank\Data\NodeCollectionInterface;
/**
* General PageRank interface that calculates the ranks of nodes. The scheduling
* and scalability depend on the implementation of the
* NodeDataSourceStrategyInterface.
*
* @see \PhpScience\PageRank\Strategy\NodeDataSourceStrategyInterface
* @package PhpScience\PageRank\Service
*/
interface PageRankAlgorithmInterface
{
/**
* It Calculates the initial ranks and then It calculates the ranks of the
* It performs the calculation over and over again until it reaches the
* maxIterate number. However, the running stops when the ranks are accurate
* enough even if the max iteration didn't reach its limit.
*
* @param int $maxIterate
*
* @return NodeCollectionInterface
*/
public function run(int $maxIterate): NodeCollectionInterface;
/**
* It runs the algorithm at first time, calculates the initial ranks. All
* nodes will have the same rank at this point.
*
* @return NodeCollectionInterface
*/
public function initiateRanking(): NodeCollectionInterface;
/**
* It can calculate the ranks of the nodes after the method initiateRanking
* executed. It performs the calculation over and over again until it
* reaches the maxIterate number. However, the running stops when the ranks
* are accurate enough even if the max iteration didn't reach its limit.
*
* @param int $maxIterate
*
* @return NodeCollectionInterface
*/
public function runBatch(int $maxIterate): NodeCollectionInterface;
/**
* After the pagerank calculation, the ranks have wide range of minus and
* plus values. This method adjusts the ranks between a minimum and a
* maximum value.
*
* @return NodeCollectionInterface
*/
public function normalize(): NodeCollectionInterface;
}