Extract Link Analysis Ranking computation from ActivityGraph
github-actions opened this issue · comments
The computation of Link Analysis Ranking (LAR) rankings in this class add cluster, difficult the implementation of plug-and-play components and reduce the source readability.
The following strategies run their calculations here
- PageRank
- PageRank + Greedy
- HITS
- HITS + PPM
- SALSA
Extracting the management of LAR data from this class will largely increase its readability.
While performing the extraction, an aspect to consider is that the implemented algorithms run the scores for all activities in the graph and runs a single interaction only.
Take the method updateNodes
as an example:
Without LARs operations and doing a cleanup, this method would be something like:
public boolean updateNodes(String activityName) {
boolean shouldPrefetch = false;
ActivityNode node = new ActivityNode(activityName);
// verify if this activity has already been added to the graph
int nodeIdx = nodeList.lastIndexOf(node);
if (nodeIdx != -1) node = nodeList.get(nodeIdx);
else nodeList.add(node);
if (current != null) {
shouldPrefetch = current.addSuccessor(node);
if (nodeIdx == -1) nodeIdx = nodeList.size() - 1;
nodeList.set(nodeIdx, node);
}
current = node;
return shouldPrefetch;
}